skip to Main Content

Laravel – Disable View Composer for Blade TestView?

The client wants the layouts.sidebar.blade.php to have a link for users with a certain role. The AppServiceProvider boots a NotificationComposer for all (*) views. The NotificationComposer has the following code $view->with('unreadNotificationCount', count(request()->user()->unreadNotifications)); I want to write a test like the…

VIEW QUESTION

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

Unable to access user id through guard after login in laravel

I have this route defined in web.php web.php Route::group(['prefix' => 'user'], function () { Route::get('login', [FrontendController::class ,'showLoginForm'])->name('user.login-show'); Route::post('login', 'AppHttpControllersLoginController@login')->name('login.post'); } this is my login controller <?php namespace AppHttpControllers; use Auth; use AppUser; use AppHttpControllersController; use IlluminateHttpRequest; use IlluminateFoundationAuthAuthenticatesUsers; use IlluminateSupportFacadesHash;…

VIEW QUESTION

Laravel successfully adding item in one to many relationship model but it is not being added to database

please help, I've been stuck here since then. I want to insert shipmentrequestitem from shipmentrequest model using update method public function update(UpdateShipmentRequestRequest $request, $id) { $shipmentRequest = ShipmentRequest::with( 'shipmentRequestItems', )->where('id',$id)->first(); $shipmentRequest->update($request->all()); $validatedData = $request->validated(); $shipmentRequestItems = $validatedData['shipmentRequestItems']; // $shipmentRequest =…

VIEW QUESTION
Back To Top
Search