Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Analyst task
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
suvorova-ma
Analyst task
Commits
12c29c76
Commit
12c29c76
authored
2 years ago
by
Shizuco
Browse files
Options
Downloads
Patches
Plain Diff
feat: access to creation users
parent
45fe5d00
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Nova/Resource.php
+11
-0
11 additions, 0 deletions
app/Nova/Resource.php
app/Providers/NovaServiceProvider.php
+2
-1
2 additions, 1 deletion
app/Providers/NovaServiceProvider.php
with
13 additions
and
1 deletion
app/Nova/Resource.php
+
11
−
0
View file @
12c29c76
...
...
@@ -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.
*
...
...
This diff is collapsed.
Click to expand it.
app/Providers/NovaServiceProvider.php
+
2
−
1
View file @
12c29c76
...
...
@@ -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'
]);
});
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment