skip to Main Content

Bug with Laravel Eloquent query buldier

I found a weird situation when nesting in a query a where with a orWhereNull. The result is returning rows with values that are neither null nor correct This is the code: $query = Document::where("active", true)->where("type_id", $document_type->id); if($selected) { $query->where(function($q)…

VIEW QUESTION

Laravel 11 – validated() and related table

I'd like to insert the user-id of the current user into a table in column "user_id". The field is a relation to the user table. Migration / database schema Schema::create('pdlocations', function (Blueprint $table) { $table->id(); $table->timestamps(); $table->decimal('lon', 10, 7); $table->decimal('lat',…

VIEW QUESTION

Grouping returned collection by a date – Laravel

I've got this function: public function getOverdue() { $jobs = Job::where('RequiredTime', '<', Carbon::now()->addDays(10)->endOfDay()) ->where('JobCancelled', '=', 0) ->where('JobCompleted', '=', 0) ->where('Ref9', '=', null) ->where('CreateDateTime', '>=', Carbon::now()->startOfMonth()) //->groupBy('RequiredTime') ->orderBy('RequiredTime', 'asc') ->get(); return view('pages.dispatch.overdue', [ 'title' => 'Overdue', 'page' => 'Overdue', 'js_action' =>…

VIEW QUESTION
Back To Top
Search