/
var
/
www
/
html
/
gnet_live
/
app
/
Models
/
Upload File
HOME
<?php namespace App\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Spatie\Sitemap\Contracts\Sitemapable; use Spatie\Sitemap\Tags\Url; use Illuminate\Support\Str; class Branch extends Model implements Sitemapable { use HasFactory; protected $table = 'branches'; protected $fillable = [ 'branch_name', 'address', 'no_telp', 'no_wa', 'maps_url', 'province', 'city', 'image', 'description', 'brochure', 'created_at', 'updated_at', ]; // const CREATED_AT = 'created_at'; // const UPDATED_AT = 'updated_at'; public function toSitemapTag(): Url|string|array { $slug = Str::slug($this->branch_name); return Url::create(route('branch.show', $slug)) ->setLastModificationDate(Carbon::create($this->updated_at)) ->setChangeFrequency(Url::CHANGE_FREQUENCY_MONTHLY) ->setPriority(0.1); } public function branchOperationals() { return $this->hasMany(BranchOperational::class, 'branch_id'); } }