-
app/Http/Controllers/UsersController.php
Open in GitHubuse Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Request; use Inertia\Inertia; class UsersController extends Controller { public function index() { return Inertia::render('Users/Index', [ 'filters' => Request::all('search', 'role', 'trashed'), 'users' => Auth::user()->account->users() ->orderByName() ->filter(Request::only('search', 'role', 'trashed')) ->get() ->transform(fn ($user) => [ 'id' => $user->id, 'name' => $user->name, 'email' => $user->email, 'owner' => $user->owner, 'photo' => $user->photo_path ? URL::route('image', ['path' => $user->photo_path, 'w' => 40, 'h' => 40, 'fit' => 'crop']) : null, 'deleted_at' => $user->deleted_at, ]), ]); } // }