skip to Main Content

Laravel many to many whereDoesntHave

I have this code here simplified. Post::whereDoesntHave('tags', function($query){ $query->whereIn(tags.id, $tagIds); }) Lets say that tagIds = [1,2,3] My goal is to retrieve only Posts that do not contain all of those tags. ex. if post has tags 1,2,3 , then…

VIEW QUESTION

Laravel – get route field parameter

When I'm testing get route in Laravel I am getting error that token field is required. $response = $this->get(route('resendsms', ['token' => $token])); web route Route::get('/auth/resendsms/{token}', [AuthController::class, 'resendsms'])->name('resendsms'); I seem not to have the right syntax What am I doing wrong?…

VIEW QUESTION

Searchbar for users in laravel blade template

I'm making a searchbar for my website, I wanna filter users for username. My function in controller look like this: function search_users(Request $request) { if ($request->search) { $searchUsers = User::where('username', 'LIKE', '%'. $request->search. '%')->get(); $data = [ "users" => $searchUsers…

VIEW QUESTION
Back To Top
Search