Fixes the configuration file
This commit is contained in:
71
app/Policies/ConfigPolicy.php
Normal file
71
app/Policies/ConfigPolicy.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Config;
|
||||
use App\Models\User;
|
||||
|
||||
final class ConfigPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any config records.
|
||||
* Config records are auto-created by the Config Service, so all users may view the list.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view a specific config record.
|
||||
*/
|
||||
public function view(User $user, Config $config): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the config record.
|
||||
* All users with Nova access may edit config values.
|
||||
*/
|
||||
public function update(User $user, Config $config): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create config records.
|
||||
* Config records are auto-created by the Config Service — manual creation is not permitted.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the config record.
|
||||
* Config records are managed by the Config Service and must not be manually deleted.
|
||||
*/
|
||||
public function delete(User $user, Config $config): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the config record.
|
||||
*/
|
||||
public function restore(User $user, Config $config): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the config record.
|
||||
*/
|
||||
public function forceDelete(User $user, Config $config): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user