| 1 | <?php namespace JobApis\JobsToMail\Models; |
||
| 7 | class Search extends Model |
||
| 8 | { |
||
| 9 | use SoftDeletes; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Indicates that the IDs are not auto-incrementing. |
||
| 13 | * |
||
| 14 | * @var bool |
||
| 15 | */ |
||
| 16 | public $incrementing = false; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * The attributes that are mass assignable. |
||
| 20 | * |
||
| 21 | * @var array |
||
| 22 | */ |
||
| 23 | protected $fillable = [ |
||
| 24 | 'user_id', |
||
| 25 | 'keyword', |
||
| 26 | 'location', |
||
| 27 | ]; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Boot function from laravel. |
||
| 31 | */ |
||
| 32 | 5 | protected static function boot() |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Defines the relationship to User model |
||
| 43 | * |
||
| 44 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
| 45 | */ |
||
| 46 | 3 | public function user() |
|
| 50 | |||
| 51 | /** |
||
| 52 | * Limits query to "active" searches |
||
| 53 | * |
||
| 54 | * @return \Illuminate\Database\Eloquent\Builder |
||
| 55 | */ |
||
| 56 | 1 | public function scopeActive($query) |
|
| 62 | |||
| 63 | /** |
||
| 64 | * Limits query to searches by user with specific email |
||
| 65 | * |
||
| 66 | * @return \Illuminate\Database\Eloquent\Builder |
||
| 67 | */ |
||
| 68 | public function scopeWhereUserEmail($query, $email = null) |
||
| 74 | } |
||
| 75 |