phase 1 and 2
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class UserJobAlert extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'keywords',
|
||||
'location',
|
||||
'job_category_id',
|
||||
'frequency',
|
||||
'is_active',
|
||||
'last_sent_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
'last_sent_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the user who created the alert.
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the category for this alert.
|
||||
*/
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(JobCategory::class, 'job_category_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to only include active alerts.
|
||||
*/
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user