Fix condition to return current team if user has teams
This commit is contained in:
parent
863acf988e
commit
9c1d585c43
@ -158,7 +158,7 @@ class User extends Authenticatable implements SendsEmail
|
|||||||
public function currentTeam()
|
public function currentTeam()
|
||||||
{
|
{
|
||||||
return Cache::remember('team:' . auth()->user()->id, 3600, function () {
|
return Cache::remember('team:' . auth()->user()->id, 3600, function () {
|
||||||
if (is_null(data_get(session('currentTeam'), 'id'))) {
|
if (is_null(data_get(session('currentTeam'), 'id')) && auth()->user()->teams->count() > 0){
|
||||||
return auth()->user()->teams[0];
|
return auth()->user()->teams[0];
|
||||||
}
|
}
|
||||||
return Team::find(session('currentTeam')->id);
|
return Team::find(session('currentTeam')->id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user