File "StoreLocation.php"
Full Path: /home/clickysoft/public_html/jmapi5.clickysoft.net/app/Models/StoreLocation.php
File size: 1.02 KB
MIME-type: text/x-php
Charset: utf-8
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class StoreLocation extends Model
{
use HasFactory;
protected $fillable = [
'title',
'address',
'latitude',
'longitude',
'state_id',
'status',
'created_at',
'updated_at',
];
protected $dates = [
'created_at',
'updated_at',
];
protected $casts = [
'created_at' => 'date:m-d-Y',
'updated_at' => 'date:m-d-Y',
];
public const STATUS_RADIO = [
'1' => 'Enabled',
'0' => 'Disabled',
];
public function state(): BelongsTo
{
return $this->belongsTo(StateSalesTax::class, 'state_id');
}
public function scopeActive($query)
{
return $query->where('status', 1);
}
protected function getStatusNameAttribute()
{
return self::STATUS_RADIO[$this->status];
}
}