Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
DoliSCAN
server
Commits
04c4b51e
Commit
04c4b51e
authored
Dec 17, 2021
by
Eric Seigne
Browse files
modification vehicule possible par le propriétaire
parent
d5f35465
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/Sharp/Policies/VehiculePolicy.php
View file @
04c4b51e
...
...
@@ -19,13 +19,14 @@
*/
namespace
App\Sharp\Policies
;
use
App\Vehicule
;
use
App\User
;
use
Spatie\Permission\Models\Role
;
use
Spatie\Permission\Models\Permission
;
class
VehiculePolicy
{
public
function
entity
()
public
function
entity
(
User
$u
)
{
//Super Admin peut tout faire :)
if
(
sharp_user
()
->
hasRole
(
'superAdmin'
))
{
...
...
@@ -38,7 +39,7 @@ class VehiculePolicy
return
true
;
}
public
function
view
()
public
function
view
(
User
$u
,
$vehiculeID
)
{
//Super Admin peut tout faire :)
if
(
sharp_user
()
->
hasRole
(
'superAdmin'
))
{
...
...
@@ -47,15 +48,19 @@ class VehiculePolicy
return
true
;
}
public
function
update
()
public
function
update
(
User
$u
,
$vehiculeID
)
{
if
(
sharp_user
()
->
hasRole
(
'superAdmin'
))
{
return
true
;
}
$verif
=
Vehicule
::
findOrFail
(
$vehiculeID
);
if
(
$verif
->
user_id
==
$u
->
id
)
{
return
true
;
}
return
false
;
}
public
function
delete
()
public
function
delete
(
User
$u
,
$vehiculeID
)
{
//Super Admin peut tout faire :)
if
(
sharp_user
()
->
hasRole
(
'superAdmin'
))
{
...
...
@@ -64,7 +69,7 @@ class VehiculePolicy
return
false
;
}
public
function
create
()
public
function
create
(
User
$u
)
{
if
(
sharp_user
()
->
hasRole
(
'superAdmin'
))
{
return
true
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment