first commit
This commit is contained in:
24
app/Models/Pengumuman.php
Normal file
24
app/Models/Pengumuman.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Pengumuman extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = ['keterangan', 'tarikh_mula_papar', 'tarikh_tamat_papar', 'admin_id'];
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'admin_id');
|
||||
}
|
||||
|
||||
public function scopeAktif($query)
|
||||
{
|
||||
$today = now()->toDateString();
|
||||
return $query->where('tarikh_mula_papar', '<=', $today)
|
||||
->where('tarikh_tamat_papar', '>=', $today);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user