Skip to content

Commit 7e4d15f

Browse files
committed
fix: collision when generating policy for user model
1 parent abb3ed9 commit 7e4d15f

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/Commands/LaravelAuthorizerCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ private function generatePolicy(string $name, string $model): void
136136
strtolower(
137137
Str::afterLast($this->getNamespacedUserModel(), '\\')
138138
)
139-
? $this->getStub()
140-
: $this->getUserPolicyPolicyStub()
139+
? $this->getUserPolicyPolicyStub()
140+
: $this->getStub()
141141
)
142142
);
143143

src/Commands/stubs/policy.stub

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class {{ class }}
1313
/**
1414
* Determine whether the user can view any models.
1515
*
16-
* @param \{{ namespacedUserModel }} $user
17-
* @return \Illuminate\Auth\Access\Response|bool
16+
* @param {{ model }} $user
17+
* @return bool
1818
*/
1919
public function viewAny({{ user }} $user): bool
2020
{
@@ -24,9 +24,9 @@ class {{ class }}
2424
/**
2525
* Determine whether the user can view the model.
2626
*
27-
* @param \{{ namespacedUserModel }} $user
28-
* @param \{{ namespacedModel }} ${{ modelVariable }}
29-
* @return \Illuminate\Auth\Access\Response|bool
27+
* @param {{ user }} $user
28+
* @param {{ model }} ${{ modelVariable }}
29+
* @return bool
3030
*/
3131
public function view({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
3232
{
@@ -36,8 +36,8 @@ class {{ class }}
3636
/**
3737
* Determine whether the user can create models.
3838
*
39-
* @param \{{ namespacedUserModel }} $user
40-
* @return \Illuminate\Auth\Access\Response|bool
39+
* @param {{ user }} $user
40+
* @return bool
4141
*/
4242
public function create({{ user }} $user): bool
4343
{
@@ -47,9 +47,9 @@ class {{ class }}
4747
/**
4848
* Determine whether the user can update the model.
4949
*
50-
* @param \{{ namespacedUserModel }} $user
51-
* @param \{{ namespacedModel }} ${{ modelVariable }}
52-
* @return \Illuminate\Auth\Access\Response|bool
50+
* @param {{ user }} $user
51+
* @param {{ model }} ${{ modelVariable }}
52+
* @return bool
5353
*/
5454
public function update({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
5555
{
@@ -59,9 +59,9 @@ class {{ class }}
5959
/**
6060
* Determine whether the user can delete the model.
6161
*
62-
* @param \{{ namespacedUserModel }} $user
63-
* @param \{{ namespacedModel }} ${{ modelVariable }}
64-
* @return \Illuminate\Auth\Access\Response|bool
62+
* @param {{ user }} $user
63+
* @param {{ model }} ${{ modelVariable }}
64+
* @return bool
6565
*/
6666
public function delete({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
6767
{
@@ -71,9 +71,9 @@ class {{ class }}
7171
/**
7272
* Determine whether the user can restore the model.
7373
*
74-
* @param \{{ namespacedUserModel }} $user
75-
* @param \{{ namespacedModel }} ${{ modelVariable }}
76-
* @return \Illuminate\Auth\Access\Response|bool
74+
* @param {{ user }} $user
75+
* @param {{ model }} ${{ modelVariable }}
76+
* @return bool
7777
*/
7878
public function restore({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
7979
{
@@ -83,9 +83,9 @@ class {{ class }}
8383
/**
8484
* Determine whether the user can permanently delete the model.
8585
*
86-
* @param \{{ namespacedUserModel }} $user
87-
* @param \{{ namespacedModel }} ${{ modelVariable }}
88-
* @return \Illuminate\Auth\Access\Response|bool
86+
* @param {{ user }} $user
87+
* @param {{ model }} ${{ modelVariable }}
88+
* @return bool
8989
*/
9090
public function forceDelete({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
9191
{

0 commit comments

Comments
 (0)