'columns' => [
[
'attribute' => 'title',
'format' => 'html',
'value' => function($model, $key, $index) {
if(($index % 2) == 0){
return "я четная строка";
}else{
return "я сука не сильно четная";
}
}
],
<?php
$path = 'path/to/img.png';
$width = $height = 300;
$background = '#ffffff';
$plain = Image::canvas($width, $height);
$plain->fill($background);
$img = Image::make($path);
$img->resize($width, null, function ($constraint) {
$constraint->aspectRatio();
});
$plain->insert($img, 'center');
$plain->save('resized.png');
ArrayHelper::getValue($array, 'foo.bar.name');
use common\components\MyClassName;
//...
$api = new MyClassName($someConfig);
$(window).bind("load", function() {
"use strict";
$(".spn_hol").fadeOut(500);
});
<?php
$input = [
[
'guid-1' => [
'one',
'two',
'three',
],
],
[
'guid-2' => [
'four',
],
],
];
var_dump(
array_reduce(
$input,
function ($acc, $item) {
foreach ($item as $guid => $values) {
$acc[$guid] = $values;
}
return $acc;
},
[]
)
);
array(2) {
["guid-1"]=>
array(3) {
[0]=>
string(3) "one"
[1]=>
string(3) "two"
[2]=>
string(5) "three"
}
["guid-2"]=>
array(1) {
[0]=>
string(4) "four"
}
}