WITH RECURSIVE supplytree AS
(
SELECT
id,
description,
parent_feature_id,
to_jsonb(feature) AS si_object,
CAST(description As varchar(1000)) AS si_fullname
FROM feature
$mystuff = collect($something);
$num = $mystuff->groupBy('dateDay')->map(function ($row) {
return $row->sum('n');
});
dd($num);
$cn = DB::connection('pgsql-private');
$cn->beginTransaction();
try {
$create = $this->create([
'fk_user_id' => $user_id,
]);
if (! $create) {
public function getMonthListFromDate(Carbon $start)
{
$start = $start->startOfMonth();
$end = Carbon::today()->startOfMonth();
do
{
$months[$start->format('m-Y')] = $start->format('F Y');
## I need to replace objects in arr1 with items from arr2 with same id
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
Don´t forget to set up experimentalDecorators as a true value into the compileOptions attribute in the tsconfig.json file.
export function decoratorName(paramName : boolean = false) {
return function(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
const originalMethod = descriptor.value;
SELECT
json_build_object(
'id', u.id,
'name', u.name,
'email', u.email,
'user_role_id', u.user_role_id,
'user_role', json_build_object(
'id', ur.id,
SELECT json_agg(row_to_json(ROW)) AS treeeeeee
FROM (
SELECT * FROM table_name
) row
$tourist = Tourist::updateOrCreate([...]);
if(!$tourist->wasRecentlyCreated && $tourist->wasChanged()){
// updateOrCreate performed an update
}
if(!$tourist->wasRecentlyCreated && !$tourist->wasChanged()){
// updateOrCreate performed nothing, row did not change
}