skip to Main Content

Laravel OrWhereNull giving wrong results

I have this long query builder where I am basically searching a table and then filter the results based on the passed query strings: $projects = Listing::query() ->when(request('q'), function($builder) { $builder->searchQuery(request('q')); }) ->when(request('tags'), function($builder) { $tags = request('tags'); $builder->whereHas('tags', function($builder)…

VIEW QUESTION

Laravel – ID getting lost during delayed job

I'm dispatching a delayed job that should created some entries in the database: `$userId = Auth::user() ? Auth::user()->getAuthIdentifier() : null; $job = new DelayedAddPeopleJob($event, $userId); dispatch($job)->delay(DelayedAddPeopleJob::DELAY);` After 15 minutes DelayedAddPeopleJob is executed and in there im creating entries in the…

VIEW QUESTION

Laravel Model attribute

I am using a third party table which very annoyingly has name and surname fields. The first name goes into name and of course the surname goes into surname. I want to concat these together in the model as I…

VIEW QUESTION

Laravel eloquent GROUP BY

I have four tables: supplies, stocks, stock_ins, and stock_outs. In the Stock controller, I want to sum the total stock_out for each supply . For this, I have used the following query: $supplies = Stock::select( 'supplies.name', 'stocks.supply_id', 'stocks.id', 'stocks.stock', 'stock_ins.quantity…

VIEW QUESTION

Laravel polymorphic relationship not working in Laravel Nova

I have the following Models and relationships. AppSubscriber.php <?php namespace AppModels; use IlluminateDatabaseEloquentModel; use IlluminateSupportFacadesDB; use IlluminateSupportStr; use IlluminateFoundationAuthUser as Authenticatable; use IlluminateNotificationsNotifiable; use GrosvLaravelPasswordlessLoginTraitsPasswordlessLogin; class Subscriber extends Authenticatable { use Notifiable, PasswordlessLogin; public function customFieldValues() { return $this->morphMany(CustomFieldValue::class, 'customFieldValueable');…

VIEW QUESTION
Back To Top
Search