How I can check existing property $this->team->playerAssignment->player in more rational way? Now I check it like this:
if ($this->team)
if (($this->team->playerAssignment))
if (($this->team->playerAssignment->player))
How I can check existing property $this->team->playerAssignment->player in more rational way? Now I check it like this:
if ($this->team)
if (($this->team->playerAssignment))
if (($this->team->playerAssignment->player))
The following has always works best for me:
if(isset(Auth::user()->client->id)){
$clientId = Auth::user()->client->id;
}
else{
dump('Nothing there...');
}
You can easily check by null coalescing operator
if ($this->team->playerAssignment->player ?? null)