File manager - Edit - /home/autoph/public_html/projects/aha-api/app/Models/BlockedDate.php
Back
<?php namespace App\Models; use App\Models\OldDB\Employee; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use OwenIt\Auditing\Contracts\Auditable; use Illuminate\Database\Eloquent\SoftDeletes; use OwenIt\Auditing\Auditable as AuditableTrait; class BlockedDate extends Model implements Auditable { use HasFactory, SoftDeletes, AuditableTrait; protected $table = 'aha_blocked_dates'; /** * The attributes that are NOT mass assignable. * */ protected $guarded = ['deleted_at',]; /** * The attributes that should be cast. * * @var array<string, string> */ protected $casts = [ 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', 'enabled' => 'boolean', ]; protected $appends = [ 'dealer_name', // 'created_by_name', ]; public function dealer() { return $this->belongsTo(Dealership::class); } public function getDealerNameAttribute() { return $this->dealer()->withTrashed()->pluck('name')->first(); } // public function getCreatedByNameAttribute() // { // if ($this->created_by) { // if($user = Employee::where('employee_id', $this->created_by)->first()) { // return ucwords(strtolower("{$user->u_fname} {$user->u_lname}")); // } // return null; // } // return null; // } public function user() { return $this->belongsTo(User::class, 'created_by'); } public function scopeEnabled($query) { return $query->where('enabled', true); } }
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.15 |
proxy
|
phpinfo
|
Settings