Skip to content

Tag: laravel

search autocomplete ajax in laravel

I am using ajax for live searching, but the problem is that It is shown only one result when I am using .html() but when I am using append() it works but every word i write it to duplicate the results, here is my code: in controller, ajax code in blade Answer Yes you set your content in your loop

Many-to-many in same model

I need to use a many-to-many relationship to one model. I have an Article model, and I want to make a function so that other articles, typically recommended, can be attached to one article. This is the function, it should work correctly. I have a question about how to create a table of relations in the databa…

use multiple Trait in laravel Controller

problem in use multiple Trait in Controller Traits in CRController error log exec command… composer dump-autoload composer dump-autoload -o php artisan config:clear php artisan view:clear php artisan route:clear php artisan cache:clear not wotking! Answer This is called Conflict Resolution. In a simple …

Laravel – Eager loading from model relationship

On my page, I have the following pagination query: In the blade template, I @foreach $followingUsers as $follower In this foreach loop, there is the following check: This is referencing I’m using the Laravel N+1 detector, and this is telling me that this I should do the following: You should add “…

Passing values to blade using redirect() and back() functions

I have successfully pass values from form to controller. Calculation is is working well, since its dump all the values using dd($fee); dd($vat); dd($Transaction_vat);. But now, when I try to pass the values to blade using return redirect()->back()->with(‘fee’, $fee ,’vat’, $vat ,…

How to add arrays with the same months in a loop?

Array Months Array Values of Months So, I wanted to add the number that falls in the same month Desired Output Code: Output: Please help me figure this out. Thank you. Answer Your problem is that you are not considering that on the 2nd time you arrive at a month that already exists you need to add it to the