select
dates.d as day,
coalesce(v.count, 0) as views_count,
coalesce(i.count, 0) as items_count
from generate_series('2018-12-26'::date, '2018-12-30', '1 day' ) as dates(d)
left join (
select created_at::date as day, count(*)
from views
group by day
) as v on v.day = dates.d
left join (
select created_at::date as day, count(*)
from items
group by day
) as i on i.day = dates.d
order by day desc
task.completed = !task.completed
DataRelationship::select(['id', 'name', etc...])->whereLinkId($link->id)->whereHas('user')
->addSelect(
DB::raw( '(select count(id) from clubs where data_relationships.id = clubs.data_relationship_id) as clubs_count' )
)->orderBy('clubs_count', 'desc')->get();
<FInputText
caption="Роль"
v-model="authForm.roles[index].name"
></FInputText>
<template v-if="hasRoleError(index)">
{{ errors.role[index].name }}
</template>
hasRoleError(index) {
return this.errors.role && this.errors.role[index];
}