Skip to content
Snippets Groups Projects
Commit 12c29c76 authored by Shizuco's avatar Shizuco
Browse files

feat: access to creation users

parent 45fe5d00
No related merge requests found
......@@ -2,11 +2,22 @@
namespace App\Nova;
use Auth;
use Illuminate\Http\Request;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Resource as NovaResource;
abstract class Resource extends NovaResource
{
public static function authorizedToCreate(Request $request)
{
if (Auth::user()) {
return (Auth::user()->role === 'admin') ? true : false;
}
return false;
}
/**
* Build an "index" query for the given resource.
*
......
......@@ -42,7 +42,8 @@ protected function gate()
{
Gate::define('viewNova', function ($user) {
return in_array($user->email, [
'admin@groupbwt.com'
'admin@groupbwt.com',
'shizuco2002@gmail.com'
]);
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment