for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Traits\enso\avatars;
use App\Models\enso\Avatars\Avatar;
use App\Service\enso\avatars\DefaultAvatar;
trait HasAvatar
{
public static function bootHasAvatar()
self::created(fn ($model) => $model->generateAvatar());
}
public function avatar()
return $this->hasOne(Avatar::class);
hasOne()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
return $this->/** @scrutinizer ignore-call */ hasOne(Avatar::class);
public function generateAvatar(): Avatar
optional($this->avatar)->delete();
return (new DefaultAvatar($this))->create();