Skip to content
Advertisement

Tag: foreach

laravel id value changed after adding a nested loop

I used the following code to display the role of the user however, when I want to edit or delete it leads me to the deleted ids number 2/3 it return the same thing even when I change the for else with foreach Attempt to read property “id” on null (View: C:laravelgautoresourcesviewsdashboarduseredit.blade.php)! when I delete the nested foreach loop everything

Foreach last item gets methode

Guys I have an array with objects, I want the last item in the foreach loop do something else then the rest. How do I archive that? Answer This will process the array of objects and do something else with the last element:

Reformat json in a correct way

I have this php code as I am trying to execute a particular function in my php project, I code the implementation correct but I ran into a small problem. Running the code above I got this result below, That’s the expected result but I want to omit [] between data But actually I wanted this result Answer You’re telling

Advertisement