Viewing: LifeStyle.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Cviebrock\EloquentSluggable\Sluggable; use App\Models\Bookmark; class LifeStyle extends Model { use HasFactory; use Sluggable; protected $table = 'articles'; protected $guarded = []; protected $appends = ['cover_image']; public function getCoverImageAttribute(){ return url(getImageURL($this->attributes['image_url'])); } public function sluggable(): array { return [ 'slug' => [ 'source' => 'title' ] ]; } public function category() { return $this->belongsTo(Category::class); } public function bookmarks() { return $this->morphMany(Bookmark::class, 'bookmarkable'); } }
Return