I have a ImageController
like this:
$image = Image::where('id', $id)->first();
return [
'image' => $image,
'image_360' => $image['360']
];
The previous lines return to the browser the following:
{
"image": {
"id": 1,
"name": "default.jpg",
"360": 1,
},
"image_360": null
}
The Image
migration:
$table->increments('id');
$table->string('name');
$table->boolean('360');
The Image
model:
class Image extends Model
{
protected $fillable = ['name', '360'];
protected $casts = [
'360' => 'boolean'
];
}
Why $images['360']
returns null
if its value is true
?