DONE: layout letter with letterhead and footer, notification for newly...
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Modules\User\Entities\Address;
|
||||
|
||||
class AddressPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function view($user, ?Address $address = null): bool
|
||||
{
|
||||
return $address === null || $address->user_id === $user->id;
|
||||
}
|
||||
|
||||
public function create($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($user, ?Address $address = null): bool
|
||||
{
|
||||
return $address === null || $address->user_id === $user->id;
|
||||
}
|
||||
|
||||
public function deleteAny($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete($user, ?Address $address = null): bool
|
||||
{
|
||||
return $address === null || $address->user_id === $user->id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Modules\User\Entities\BankDetail;
|
||||
|
||||
class BankDetailPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function view($user, ?BankDetail $bankDetail = null): bool
|
||||
{
|
||||
return $bankDetail === null || $bankDetail->user_id === $user->id;
|
||||
}
|
||||
|
||||
public function create($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($user, ?BankDetail $bankDetail = null): bool
|
||||
{
|
||||
return $bankDetail === null || $bankDetail->user_id === $user->id;
|
||||
}
|
||||
|
||||
public function deleteAny($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete($user, ?BankDetail $bankDetail = null): bool
|
||||
{
|
||||
return $bankDetail === null || $bankDetail->user_id === $user->id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Modules\User\Entities\Bank;
|
||||
|
||||
class BankPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function view($user, ?Bank $bank = null): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function create($user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('tambah bank');
|
||||
}
|
||||
|
||||
public function update($user, ?Bank $bank = null): bool
|
||||
{
|
||||
return $user->hasPermissionTo('kemaskini bank');
|
||||
}
|
||||
|
||||
public function deleteAny($user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('hapus bank');
|
||||
}
|
||||
|
||||
public function delete($user, ?Bank $bank = null): bool
|
||||
{
|
||||
return $user->hasPermissionTo('hapus bank');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Modules\User\Entities\Employment;
|
||||
|
||||
class EmploymentPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function view($user, ?Employment $employement = null): bool
|
||||
{
|
||||
return $employement === null || $employement->user_id === $user->id;
|
||||
}
|
||||
|
||||
public function create($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($user, ?Employment $employement = null): bool
|
||||
{
|
||||
return $employement === null || $employement->user_id === $user->id;
|
||||
}
|
||||
|
||||
public function deleteAny($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete($user, ?Employment $employement = null): bool
|
||||
{
|
||||
return $employement === null || $employement->user_id === $user->id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Modules\User\Entities\Heir;
|
||||
|
||||
class HeirPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function view($user, ?Heir $heir = null): bool
|
||||
{
|
||||
return $heir === null || $heir->user_id === $user->id;
|
||||
}
|
||||
|
||||
public function create($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($user, ?Heir $heir = null): bool
|
||||
{
|
||||
return $heir === null || $heir->user_id === $user->id;
|
||||
}
|
||||
|
||||
public function deleteAny($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete($user, ?Heir $heir = null): bool
|
||||
{
|
||||
return $heir === null || $heir->user_id === $user->id;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ class UserPolicy
|
||||
*/
|
||||
public function create($user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('tambah pengguna');
|
||||
return $user->hasPermissionTo('daftar pengguna baru');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ class UserPolicy
|
||||
*/
|
||||
public function deleteAny($user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('hapus pengguna');
|
||||
return $user->hasPermissionTo('padam akaun pengguna');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,6 +54,14 @@ class UserPolicy
|
||||
*/
|
||||
public function delete($user, ?User $userModel = null): bool
|
||||
{
|
||||
return $user->hasPermissionTo('hapus pengguna');
|
||||
return $user->hasPermissionTo('padam akaun pengguna');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore a soft-deleted model.
|
||||
*/
|
||||
public function restore($user, ?User $userModel = null): bool
|
||||
{
|
||||
return $user->hasPermissionTo('padam akaun pengguna');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user