It fixes the issues with namespaces in the make:policy command.
How should this be manually tested?
Install this version of the library: composer require flipbox/lumen-generator:dev-fix_make_policy_command
Create a new plain policy: php artisan make:policy MyPolicy
You should end up with a new policy looking like this:
<?php
namespace App\Policies;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class MyPolicy
{
use HandlesAuthorization;
/**
* Create a new policy instance.
*
* @return void
*/
public function __construct()
{
//
}
}
4. Create a new policy using a model: `php artisan make:policy MyPolicy --model=Post`
5. You should end up with a new policy looking like this:
```php
<?php
namespace App\Policies;
use App\Models\Post;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class MyPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any posts.
*
* @param \App\Models\User $user
* @return mixed
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the post.
*
* @param \App\Models\User $user
* @param \App\Models\Post $post
* @return mixed
*/
public function view(User $user, Post $post)
{
//
}
/**
* Determine whether the user can create posts.
*
* @param \App\Models\User $user
* @return mixed
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the post.
*
* @param \App\Models\User $user
* @param \App\Models\Post $post
* @return mixed
*/
public function update(User $user, Post $post)
{
//
}
/**
* Determine whether the user can delete the post.
*
* @param \App\Models\User $user
* @param \App\Models\Post $post
* @return mixed
*/
public function delete(User $user, Post $post)
{
//
}
}
What does this Pull Request Do?
It fixes the issues with namespaces in the
make:policy
command.How should this be manually tested?
composer require flipbox/lumen-generator:dev-fix_make_policy_command
php artisan make:policy MyPolicy
namespace App\Policies;
use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization;
class MyPolicy { use HandlesAuthorization;
}
Any background context you want to provide?
N/A
What are the relevant tickets?
make:policy problem #112
Any extra info?