skip to Main Content

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

Laravel – How in user model with pivot to tasks to restrict to only uncompleted tasks?

On laravel 10 site I have 3 related tables : Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name'); ... $table->timestamp('created_at')->useCurrent(); }); Schema::create('tasks', function (Blueprint $table) { $table->id(); $table->foreignId('creator_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE'); $table->boolean('completed')->default(false); ... $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->nullable(); }); Schema::create('task_user', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('user_id')->unsigned()->index(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');…

VIEW QUESTION

Laravel Basic BelongsToMany

I have ProductCollection Model and AttributeValue Model which have a common table product_collection_attributes that has 2 columns: product_collection_id and attribute_value_id that are a foreign key to their respective tables and are both a primary key. In ProductCollection Model relation is:…

VIEW QUESTION
Back To Top
Search