reconstruction of the project
This commit is contained in:
@@ -2,11 +2,16 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class CurrentFlag extends Model
|
||||
class CurrentFlag extends BaseModel
|
||||
{
|
||||
protected $table = 'current_flag';
|
||||
|
||||
// CI model didn't specify timestamps. Since the table has created_at/updated_at columns,
|
||||
// you can enable auto-management. If your table does NOT actually have them, set false.
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'student_name',
|
||||
@@ -26,5 +31,33 @@ class CurrentFlag 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