海工商新版后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

22 lines
452 B

<?php
namespace Tests\Models;
use Illuminate\Database\Eloquent\Model;
class MultipleImage extends Model
{
protected $table = 'test_multiple_images';
public function setPicturesAttribute($pictures)
{
if (is_array($pictures)) {
$this->attributes['pictures'] = json_encode($pictures);
}
}
public function getPicturesAttribute($pictures)
{
return json_decode($pictures, true) ?: [];
}
}