0
I am creating a command in Laravel(php) that looks for an image file that is blob in the database and saved in a folder, And as not all users have image I want to make a conditional that if the file does not exist it simply skips the process but when I put the user who has no photo it does not skip the process and returns Trying to get Property 'logo_foto' of non-object
public function handle()
{
// $field = $this->ask('Fields?');
$id = $this->argument('numero');
$getInfo = Parceiro::where('id', $id)->first();
if($getInfo->logo_foto) {
$photo = $getInfo->getRawOriginal('logo_foto');
$format = Helper_Base64::getFileFormat($photo);
$randonName = rand(1, 800);
$path2 = public_path("users/logo/{$randonName}");
if(!File::isDirectory($path2)){
File::makeDirectory($path2, 0777, true, true);
}
$path = "$path2/{$randonName}.$format";
Partner::getLogoUrl($id, false, null, $path);
// Partner::getLogoUrl($id);
$getInfo->img_path = $path;
$getInfo->save();
}