1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace App\Models;
- use DateTimeInterface;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- class Alarm extends Model
- {
- use HasFactory,SoftDeletes;
- protected $table = 'js_call';
- protected $hidden = [
- //
- ];
- public $timestamps = FALSE;
- const DELETED_AT = 'delete_time';
- protected $dateFormat = 'U';
- protected $appends = [];
- protected function serializeDate(DateTimeInterface $date): string
- {
- return $date->format('Y-m-d H:i:s');
- }
- public function getIsBusyAttribute()
- {
- return Order::where(['jiedan_js_id' => $this->id, 'status' => 6])->count();
- }
- public function getSiteAttribute()
- {
- return ArtificerSite::where(['js_id' => $this->id])->first();
- }
- public function order()
- {
- return $this->hasOne(Order::class, 'id', 'order_id');
- }
- }
|