Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Produk extends Model
- {
- use SoftDeletes;
- protected $table = "produks";
- protected $fillable = ['kategori_id', 'user_id', 'url_images', 'bahan', 'tebel_bahan', 'warna', 'gambar', 'judul', 'keterangan', 'harga', 'slug'];
- protected $casts = [
- 'deleted_at' => 'string',
- 'gambar' => 'array',
- ];
- protected $appends = ['url_images'];
- public function getUrlImagesAttribute()
- {
- $url_images = [];
- foreach ($this->gambar as $image) {
- $url_images[] = asset('upload/' . $image);
- }
- return $url_images;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement