mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-25 09:44:04 +01:00
Blank icon property if icon file is missing during store/update
This commit is contained in:
parent
c948bc5f24
commit
f2dbf3f1e2
@ -52,6 +52,28 @@ public function getIconAttribute($value)
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prevent setting a missing icon
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function setIconAttribute($value)
|
||||
{
|
||||
|
||||
if( !Storage::exists('public/icons/' . pathinfo($value)['basename']) ) {
|
||||
|
||||
$this->attributes['icon'] = '';
|
||||
}
|
||||
else {
|
||||
|
||||
$this->attributes['icon'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the account type.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user