Code improvements
This commit is contained in:
+3
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
@@ -115,10 +115,10 @@ class User extends Authenticatable
|
||||
}
|
||||
|
||||
public function localGroup() : Tenant {
|
||||
return $this->belongsTo(Tenant::class, 'local_group', 'slug')->first();
|
||||
return $this->belongsTo(Tenant::class, 'local_group', 'slug')->firstOrFail();
|
||||
}
|
||||
|
||||
public function costUnits()
|
||||
public function costUnits() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(CostUnit::class, 'cost_unit_treasurers', 'user_id', 'cost_unit_id')
|
||||
->withTimestamps();
|
||||
|
||||
Reference in New Issue
Block a user