Viewing: Prospects.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Storage; use Illuminate\Database\Eloquent\Factories\HasFactory; use Cviebrock\EloquentSluggable\Sluggable; class Prospects extends Model { use HasFactory; use Sluggable; protected $table = 'prospectus'; protected $guarded = []; public function sluggable(): array { return [ 'slug' => [ 'source' => 'title' ] ]; } public function category() { return $this->belongsTo(Category::class); } public function stories() { return $this->belongsTo(\App\Models\Story::class,'story_id')->where('status',1); } public function countries() { return $this->belongsTo(\App\Models\Service::class,'country_id'); } protected $appends = ['image_path']; public function getImagePathAttribute() { return Storage::url($this->image_url); } }
Return