Viewing: Story.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Storage; use Cviebrock\EloquentSluggable\Sluggable; use App\Models\Bookmark; class Story extends Model { use Sluggable; protected $hidden = []; protected $table = 'stories'; protected $guarded = []; protected $appends = ['cover_image']; public function getCoverImageAttribute() { return url(getImageURL($this->attributes['image_url'])); } public function getImagePathAttribute() { return Storage::url($this->icon); } public function offices() { return $this->hasMany(Office::class); } public function sluggable(): array { return [ 'slug' => [ 'source' => 'title' ] ]; } public function bookmarks() { return $this->morphMany(Bookmark::class, 'bookmarkable'); } }
Return