reconstruction of the project
This commit is contained in:
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class PrintRequest extends Model
|
||||
class PrintRequest extends BaseModel
|
||||
{
|
||||
protected $table = 'print_requests';
|
||||
|
||||
// ✅ CI: useTimestamps = true (created_at/updated_at)
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'teacher_id',
|
||||
'admin_id',
|
||||
@@ -20,5 +24,28 @@ class PrintRequest extends Model
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'teacher_id' => 'integer',
|
||||
'admin_id' => 'integer',
|
||||
'class_id' => 'integer',
|
||||
'num_copies' => 'integer',
|
||||
'required_by' => 'datetime', // if stored as DATETIME
|
||||
];
|
||||
|
||||
/* Optional relationships */
|
||||
public function teacher()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'teacher_id');
|
||||
}
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'admin_id');
|
||||
}
|
||||
|
||||
public function schoolClass()
|
||||
{
|
||||
return $this->belongsTo(SchoolClass::class, 'class_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user