finish register special

This commit is contained in:
2020-03-22 17:44:43 +01:00
parent 3f96cc6fe3
commit 18d0841a7d
34 changed files with 2190 additions and 118 deletions

View File

@@ -0,0 +1,93 @@
<?php
namespace App\Policies;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\User $user
* @return mixed
*/
public function viewAny(User $user)
{
return true;
}
/**
* Determine whether the user can view the model.
*
* @param \App\User $user
* @param \App\User $model
* @return mixed
*/
public function view(User $user, User $model)
{
return true;
}
/**
* Determine whether the user can create models.
*
* @param \App\User $user
* @return mixed
*/
public function create(User $user)
{
return $user->isAdmin();
}
/**
* Determine whether the user can update the model.
*
* @param \App\User $user
* @param \App\User $model
* @return mixed
*/
public function update(User $user, User $model)
{
return $user->isAdmin() || $user->id === auth()->user()->id;
}
/**
* Determine whether the user can delete the model.
*
* @param \App\User $user
* @param \App\User $model
* @return mixed
*/
public function delete(User $user, User $model)
{
return $user->isAdmin() || $user->id === auth()->user()->id;
}
/**
* Determine whether the user can restore the model.
*
* @param \App\User $user
* @param \App\User $model
* @return mixed
*/
public function restore(User $user, User $model)
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\User $user
* @param \App\User $model
* @return mixed
*/
public function forceDelete(User $user, User $model)
{
return false;
}
}