43 lines
839 B
PHP
43 lines
839 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class JobPost extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'employer_id',
|
|
'title',
|
|
'workers_needed',
|
|
'job_type',
|
|
'location',
|
|
'salary',
|
|
'start_date',
|
|
'description',
|
|
'requirements',
|
|
'status',
|
|
];
|
|
|
|
protected $casts = [
|
|
'start_date' => 'date',
|
|
'salary' => 'decimal:2',
|
|
'workers_needed' => 'integer',
|
|
];
|
|
|
|
public function employer()
|
|
{
|
|
return $this->belongsTo(User::class, 'employer_id');
|
|
}
|
|
|
|
|
|
public function applications()
|
|
{
|
|
return $this->hasMany(JobApplication::class, 'job_id');
|
|
}
|
|
}
|