Job_title.php
611 Bytes
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Job_title extends Model
{
use HasFactory;
protected $fillable = [
'name',
'is_remove',
'parent_id',
];
/*
* Связь модели Вакансии (Ad_employer) с моделью Должности (Job_title)
*/
public function Ads() {
return $this->belongsToMany(Ad_employer::class, 'ad_jobs');
}
public function scopeActive($query) {
return $query->where('is_remove', '=', '0');
}
}