egmose5492dk
egmose5492dk
FFilament
Created by egmose5492dk on 4/10/2024 in #❓┊help
Only access to certain resulsts in resource - How do i limit that?
@John Your´e absolutely right. Right after i made this post, i rewrote it a bit, to get the marinas accesible from the model, and now it seems to be working as expected.
public function update(User $user, Marina $marina): bool
{
// Check if the user has the 'admin' role
if ($user->hasRole('admin')) {
return true; // Admin can update any marina
}

// Use the same logic as the 'editable' scope in the Marina model
** if ($user->hasRole('marina_master')) {
return $marina->canManageMarinas()->where('user_id', $user->id)->exists();
}**

return false; // User does not have permission to update this marina
}

public function update(User $user, Marina $marina): bool
{
// Check if the user has the 'admin' role
if ($user->hasRole('admin')) {
return true; // Admin can update any marina
}

// Use the same logic as the 'editable' scope in the Marina model
** if ($user->hasRole('marina_master')) {
return $marina->canManageMarinas()->where('user_id', $user->id)->exists();
}**

return false; // User does not have permission to update this marina
}

Thanks 🙂
3 replies
FFilament
Created by toeknee on 4/10/2024 in #❓┊help
->money() is rounding?
->numeric(decimalPlaces: 2)
4 replies
FFilament
Created by egmose5492dk on 12/30/2023 in #❓┊help
Add multiple translation to translation table
For the Admin interface i´m using filament. No package is used besides that. The idea is to build an option for me to easily manage translations. I will write them to the database, anden create the JSON files based on that.
8 replies
FFilament
Created by egmose5492dk on 12/30/2023 in #❓┊help
Add multiple translation to translation table
Sorry for being offline - Has had some family related manners It doesnt log anything unfortunately. So it isnt being called which i excpect it would. The exeption is thrown in App  \  Http  \  Middleware  \  LocaleMiddleware   : 19 handle Line 19: return $next($request); class LocaleMiddleware { public function handle($request, Closure $next) { if (Session::has('applocale') && array_key_exists(Session::get('applocale'), config('languages'))) { App::setLocale(Session::get('applocale')); } return $next($request); } }
8 replies
FFilament
Created by egmose5492dk on 12/30/2023 in #❓┊help
Add multiple translation to translation table
Anyone with an idea? 🙂
8 replies
FFilament
Created by egmose5492dk on 12/25/2023 in #❓┊help
Filament Checkboxlist returns raw HTML
Thx @Dennis Koch - I will try to see if i can figure out making the change.
5 replies
FFilament
Created by egmose5492dk on 12/25/2023 in #❓┊help
Filament Checkboxlist returns raw HTML
No one with an idea? 🙂
5 replies