I have Cam model and for each cam I have a folder with images on server. I just need to get all image names in custom attribute but I don't get it. There is no need to call actions within table. I tried extending constructor but no luck.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Cam extends Model
{
protected $table = 'cams';
protected $guarded = 'id';
public $timestamps = false;
public $images = null;
public function __construct($attributes = array())
{
parent::__construct($attributes);
$this->images = 'kk';
}
public function getVideosAttribute($value) {
return explode(',', $value);
}
public function city() {
return $this->belongsTo('App\City');
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire