-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <[email protected]> # Conflicts: # public/css/build/app.css # public/css/build/overrides.css # public/css/dist/all.css # public/mix-manifest.json
- Loading branch information
Showing
13 changed files
with
200 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,10 +214,12 @@ public function isSuperUser() | |
public function isDeletable() | ||
{ | ||
return Gate::allows('delete', $this) | ||
&& ($this->assets()->count() === 0) | ||
&& ($this->licenses()->count() === 0) | ||
&& ($this->consumables()->count() === 0) | ||
&& ($this->accessories()->count() === 0) | ||
&& ($this->assets->count() === 0) | ||
&& ($this->licenses->count() === 0) | ||
&& ($this->consumables->count() === 0) | ||
&& ($this->accessories->count() === 0) | ||
&& ($this->managedLocations->count() === 0) | ||
&& ($this->managesUsers->count() === 0) | ||
&& ($this->deleted_at == ''); | ||
} | ||
|
||
|
@@ -410,6 +412,19 @@ public function manager() | |
return $this->belongsTo(self::class, 'manager_id')->withTrashed(); | ||
} | ||
|
||
/** | ||
* Establishes the user -> managed users relationship | ||
* | ||
* @author A. Gianotto <[email protected]> | ||
* @since [v6.4.1] | ||
* @return \Illuminate\Database\Eloquent\Relations\Relation | ||
*/ | ||
public function managesUsers() | ||
{ | ||
return $this->hasMany(\App\Models\User::class, 'manager_id'); | ||
} | ||
|
||
|
||
/** | ||
* Establishes the user -> managed locations relationship | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.