$sql = "SELECT * FROM table WHERE foo=:foo AND id IN ($in) AND bar=:bar";
$stm = $db->prepare($sql);
$stm->execute(array_merge($params,$in_params))
set @row:=0;
SELECT @row:=@row+1 as row, x.name, x.sum_number, x.max_date
FROM (
select name, sum(number) as sum_number, max(`date`) as max_date FROM table group by name order by sum(number) desc
) as x;
'options' => array(
PDO::ATTR_EMULATE_PREPARES => true
),
$conn = DB::connection();
$query = $conn->query()->from('users')->select('id')->first();
$a1 = $conn->getPdo()->setAttribute(\PDO::ATTR_STRINGIFY_FETCHES,1);
$a2 = $conn->getPdo()->setAttribute(\PDO::ATTR_EMULATE_PREPARES,1);
$query2 = $conn->query()->from('users')->select('id')->first();
dd($a1, $a2, $conn->getPdo(), $query, $query2);
class ArticleResolver implements UrlRoutable
{
public function getRouteKeyName()
{
return '';
}
public function getRouteKey()
{
// TODO: Implement getRouteKey() method.
}
public function resolveRouteBinding($value)
{
// логика поиска статьи по SLUG в разных таблицах
$profile = Profile::where('theme','=', $value)->first();
if($profile){
return $profile;
}
$user = User::where('slug','=',$value)->first();
if($user){
return $user;
}
throw new NotFoundHttpException();
}
}
// в контроллере
public function article(ArticleResolver $article_slug){
// определяете нужное представление
return view("articles.categories.{$article_slug->category_id}.show", ['article' => $article_slug]);
}
А дальше что вы делаете с $value?