reconstruction of the project
This commit is contained in:
+35
-3
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class Flag extends Model
|
||||
class Flag extends BaseModel
|
||||
{
|
||||
protected $table = 'flag';
|
||||
|
||||
// Table contains created_at/updated_at; enable auto timestamps (recommended).
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'student_name',
|
||||
@@ -26,5 +30,33 @@ class Flag extends Model
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'student_id' => 'integer',
|
||||
'updated_by_open' => 'integer',
|
||||
'updated_by_closed' => 'integer',
|
||||
'updated_by_canceled' => 'integer',
|
||||
'flag_datetime' => 'datetime',
|
||||
];
|
||||
|
||||
/* Optional relationships */
|
||||
public function student()
|
||||
{
|
||||
return $this->belongsTo(Student::class, 'student_id');
|
||||
}
|
||||
|
||||
public function openedBy()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by_open');
|
||||
}
|
||||
|
||||
public function closedBy()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by_closed');
|
||||
}
|
||||
|
||||
public function canceledBy()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by_canceled');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user