I suggest https://laracasts.com/series/30-days-to-learn-laravel-11 (free course).
It's easier than trying to explain in a bunch of code.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm building on laravel, a userlist, so far i could list all the users of the website, and i also have a delete and an edit button, i'm using this view:
<x-app-layout>
<div>
@foreach ($users as $user)
<div class="p-4 bg-white w-1/3 m-auto my-2 h-max flex-col text-left">
<span class="inline-block text-3xl font-bold text-[#0530AD] text-center w-full mb-2">
{{ $user['name'] }}
</span>
<div>
<span class="text-lg font-bold">Email :</span> {{ $user['email'] }}
</div>
<div>
<span class="text-lg font-bold">Email verified at :</span> {{ $user['email_verified_at'] }}
</div>
<div>
<span class="text-lg font-bold">Role :</span> {{ $roles[$user['cargo']]['cargo'] ?? 'Role not found' }}
</div>
<div>
<span class="text-lg font-bold">Created at :</span> {{ $user['created_at'] }}
</div>
<div>
<span class="text-lg font-bold">Updated at :</span> {{ $user['updated_at'] }}
</div>
<div class="mt-4 text-center">
<x-primary-button>
Edit User
</x-primary-button>
<x-red-button>
Delete User
</x-red-button>
</div>
</div>
@endforeach
</div>
</x-app-layout>
which gets data from this controller:
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User;
use App\Models\Cargo;
use Illuminate\Support\Facades\Auth;
class UserController extends Controller
{
public function show(Request $request){
$users = User::all();
$roles = Cargo::all()->keyBy('id');
$user = Auth::user();
if(isAdmin($user)){
return view('userlist', compact('users', 'roles'));
}
return response('Unauthorized.', 401);
}
}
but now i'm wondering how will i proceed to program these two buttons for editing or removing a user, i know i'd maybe need to redirect the user to another route, which would communicate to a controller and render a view, but that view should have the context of which user i choosed to edit or delete, what is the best approach for me?
Please or to participate in this conversation.