generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from bezhanSalleh/fix/auth-provider-policy-ge…
…neration Fix/auth provider policy generation
- Loading branch information
Showing
2 changed files
with
155 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<?php | ||
|
||
namespace {{ namespace }}; | ||
|
||
use {{ auth_model_fqcn }}; | ||
|
||
use Illuminate\Auth\Access\HandlesAuthorization; | ||
|
||
class {{ modelPolicy }} | ||
{ | ||
use HandlesAuthorization; | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can view any models. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function viewAny({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ ViewAny }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can view the model. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function view({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ View }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can create models. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function create({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ Create }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can update the model. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function update({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ Update }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can delete the model. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function delete({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ Delete }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can bulk delete. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function deleteAny({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ DeleteAny }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can permanently delete. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function forceDelete({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ ForceDelete }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can permanently bulk delete. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function forceDeleteAny({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ ForceDeleteAny }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can restore. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function restore({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ Restore }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can bulk restore. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function restoreAny({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ RestoreAny }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can bulk restore. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function replicate({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ Replicate }}'); | ||
} | ||
|
||
/** | ||
* Determine whether the {{ auth_model_variable }} can reorder. | ||
* | ||
* @param \{{ auth_model_fqcn }} ${{ auth_model_variable }} | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function reorder({{ auth_model_name }} ${{ auth_model_variable }}) | ||
{ | ||
return ${{ auth_model_variable }}->can('{{ Reorder }}'); | ||
} | ||
} |