public function bindValue(Cell $cell, $value)
{
// проверяем у cell нужная ли нам это колонка-ячейка нужное ли значение и через $cell->getStyle шарашим свой стиль
}
public function user()
{
$instance = $this->newRelatedInstance(User::class);
$foreignKey = `request_discussions`.`request_id`;
$localKey = $this->getKeyName();
return $this->newHasOne($instance->newQuery(), $this, $foreignKey, $localKey)->join('orders.requests', 'requests.user_id', '=', 'users.id');
}
SELECT
s.*,
CONCAT(u.name, ' ', s.house_number) as address
FROM
users u
LEFT JOIN streets s ON s.id = u.street_id
WHERE u.full_name LIKE '%на%'
OR CONCAT(u.name, ' ', s.house_number) LIKE '%на%'
LIMIT 0, 10
public function scopeOfSearch(Builder $query, $search){
return $query->leftjoin('streets', 'streets.id', '=', 'users.street_id')->where(function($builder) use($search){
return $query->whereRaw('CONCAT(u.name, ' ', s.house_number) like ?', '%'.$search.'%')->orWhere('users.full_name', 'like', '%'.$search.'%');
});
}
$users = User::ofSearch($search)->paginate(10);
Да и вообще как реализовать Multi connection для db (не в env же всё прописывать).
([a-z])\/\1[^\/]+
Route::any('/genres/{literaGenre}', function ($literaAndGenre) {
dump('Got it', explode('/', $literaAndGenre));
})->where(['literaGenre' => '(?P<litera>[a-z]{1})\/(?P=litera)[^\/]+']);
echo SomeModel::setConnection('')->count();
protected $connection = '';
$fleets = DB::table('fleets') // записи кроме $arr
->join('fleet_dictionaries', 'fleet_dictionaries.id', '=', 'fleets.fleet_id')
->select('fleets.fleet_id','fleet_dictionaries.manufacture','fleet_dictionaries.description', DB::RAW('IF(ISNULL(fleets_with_dopusk.fleet_id), "есть допуск", "нет допуска")'))
->leftJoinSub(function($query) use($id){
return $query->from('fleet_users')
->join('fleet_dictionaries', 'fleet_dictionaries.id', '=', 'fleet_users.fleet_id')
->select('fleet_users.fleet_id')
->where('fleet_users.user_id', $id);
}, 'fleets_with_dopusk', 'fleets_with_dopusk.fleet_id', '=', 'fleet_users.fleet_id')
->where('fleets.airline_id', $idport)
->distinct('fleets.fleet_id')
->get();
$fleets = DB::table('fleets') // записи кроме $arr
->join('fleet_dictionaries', 'fleet_dictionaries.id', '=', 'fleets.fleet_id')
->select('fleets.fleet_id','fleet_dictionaries.manufacture','fleet_dictionaries.description')
->whereNotIn('fleets.fleet_id', function($query) use($id){
return $query->from('fleet_users')
->join('fleet_dictionaries', 'fleet_dictionaries.id', '=', 'fleet_users.fleet_id')
->select('fleet_users.fleet_id')
->where('fleet_users.user_id', $id);
})
->where('fleets.airline_id', $idport)
->distinct('fleets.fleet_id')
->get();