Files
laravel-backend/app/Repositories/CourseNotification.php
Joris Slagter df155bb13d
Some checks failed
continuous-integration/drone/push Build is failing
Initial Laravel API import
- Complete GGZ Ecademy Laravel backend application
- RESTful API for learning products, members, filters
- Authentication and authorization system
- Database migrations and seeders
- Custom CRUD generator commands
- Email notification system
- Integration with frontend applications
2025-12-02 17:40:21 +01:00

45 lines
851 B
PHP

<?php
namespace App\Repositories;
use DateTime;
use DateInterval;
use Illuminate\Database\Eloquent\Model;
class CourseNotification extends Model
{
protected $dates = ['deleted_at'];
protected $guarded = ['id'];
public function learning_product()
{
return $this->belongsTo(LearningProduct::class);
}
public function scopeNotExpired($query)
{
return $query->where('date', '>', new DateTime());
}
public function scopeExpired($query)
{
return $query->where('date', '<', new DateTime());
}
public function scopeExpireInFiveMinutes($query)
{
$minutes_to_add = 5;
$time = new DateTime();
$time->add(new DateInterval('PT' . $minutes_to_add . 'M'));
// $stamp = $time->format('Y-m-d H:i');
return $query->where('date', '<', $time);
}
public function scopeNotSent($query)
{
return $query->where('sent', false);
}
}