45 lines
798 B
PHP
45 lines
798 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class PlanRequest extends Model
|
|
{
|
|
protected $fillable = [
|
|
'user_id',
|
|
'plan_id',
|
|
'status',
|
|
'message',
|
|
'approved_at',
|
|
'rejected_at',
|
|
'approved_by',
|
|
'rejected_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'approved_at' => 'datetime',
|
|
'rejected_at' => 'datetime',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function plan()
|
|
{
|
|
return $this->belongsTo(Plan::class);
|
|
}
|
|
|
|
public function approver()
|
|
{
|
|
return $this->belongsTo(User::class, 'approved_by');
|
|
}
|
|
|
|
public function rejector()
|
|
{
|
|
return $this->belongsTo(User::class, 'rejected_by');
|
|
}
|
|
}
|