Blame view
app/Models/Ad_employer.php
1.98 KB
02a1ed535
|
1 2 3 4 5 6 7 8 9 10 |
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Ad_employer extends Model { use HasFactory; |
bb2fb443d
|
11 |
|
29350503f
|
12 13 14 15 16 17 18 19 20 21 22 23 |
protected $fillable = [ 'name', 'telephone', 'email', 'salary', 'category_id', 'text', 'employer_id', 'city', 'sort', 'is_remove', 'active_is', |
be3039cb9
|
24 25 26 |
'status', 'sroch_vacancy', 'favorite_vacancy' |
29350503f
|
27 |
]; |
bb2fb443d
|
28 29 |
/* * Связь таблицы employers с таблицей ad_employers |
82a9544dc
|
30 |
многие-к-одному |
bb2fb443d
|
31 32 33 34 |
*/ public function employer() { return $this->belongsTo(Employer::class, 'employer_id'); } |
82a9544dc
|
35 36 37 38 39 40 41 42 |
/* * Связь модели Вакансии (Ad_employer) с моделью Должности (Job_title) многие-ко-многим */ public function jobs() { return $this->belongsToMany(Job_title::class, 'ad_jobs'); } |
d152a3a68
|
43 44 45 46 |
// Связь модели Вакансии с моделью Коды должностей и вакансий public function jobs_code() { return $this->hasMany(Ad_jobs::class); } |
82a9544dc
|
47 48 49 50 51 52 53 |
/* * Связь модели Вакансия (Ad_employers) с моделью Отклик на Вакансию (Ad_response) один-ко-многим */ public function response() { return $this->hasMany(ad_response::class); } |
29350503f
|
54 |
|
5b68533bb
|
55 56 |
// Связь модели Категории (Categories) с моделью Вакансии public function cat() { |
d152a3a68
|
57 |
return $this->hasMany(Category::class, 'id'); |
5b68533bb
|
58 |
} |
29350503f
|
59 60 61 |
public function scopeActive($query) { return $query->where('is_remove', '=', '0'); } |
d152a3a68
|
62 63 64 65 66 |
// public function ad_job() { return $this->hasMany(Ad_jobs::class); } |
468369903
|
67 68 69 70 71 |
// Связь Вакансии с должностями (0-0 - 1) public function job_titles() { return $this->belongsToMany(Job_title::class, 'title_workers'); } |
02a1ed535
|
72 |
} |