for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace JobApis\JobsToMail\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Ramsey\Uuid\Uuid;
class Recruiter extends Model
{
/**
* Indicates that the IDs are not auto-incrementing.
*
* @var bool
*/
public $incrementing = false;
* The attributes that are mass assignable.
* @var array
protected $fillable = [
'name',
'url',
];
* Boot function from laravel.
protected static function boot()
parent::boot();
static::creating(function ($model) {
$model->{$model->getKeyName()} = Uuid::uuid4();
});
}
* Very simple filter to get recruiting firms by name
* @param $query
* @param string $name
* @return \Illuminate\Database\Eloquent\Builder
public function scopeWhereNameLike($query, $name = null)
$where = "to_tsvector('english', name) @@ plainto_tsquery('english', ?)";
return $query->whereRaw($where, [$name]);