b05e074456
Co-authored-by: ISMAIL MASSERAN <topaz@ISMAILs-Macbook.local> Co-authored-by: ISMAIL MASSERAN <topaz@Mac.dlinkrouter.local> Reviewed-on: #11
60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Modules\Feedback\Policies;
|
|
|
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
|
use Modules\Feedback\Entities\Feedback;
|
|
|
|
class FeedbackPolicy
|
|
{
|
|
use HandlesAuthorization;
|
|
|
|
/**
|
|
* Determine whether the user can view any models.
|
|
*/
|
|
public function viewAny($user): bool
|
|
{
|
|
return $user->hasPermissionTo('lihat maklum balas'); // Adjust based on your authorization logic
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can view the model.
|
|
*/
|
|
public function view($user, ?Feedback $feedback = null): bool
|
|
{
|
|
return $user->hasPermissionTo('lihat maklum balas'); // Adjust based on your authorization logic
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can create models.
|
|
*/
|
|
public function create($user): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can update the model.
|
|
*/
|
|
public function update($user, ?Feedback $feedback = null): bool
|
|
{
|
|
return $user->hasPermissionTo('kemaskini maklum balas'); // Adjust based on your authorization logic
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can delete any model.
|
|
*/
|
|
public function deleteAny($user): bool
|
|
{
|
|
return $user->hasPermissionTo('padam maklum balas'); // Adjust based on your authorization logic
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can delete the model.
|
|
*/
|
|
public function delete($user, ?Feedback $feedback = null): bool
|
|
{
|
|
return $user->hasPermissionTo('padam maklum balas'); // Adjust based on your authorization logic
|
|
}
|
|
}
|