Add check that photos key exists before trying to do something with it
This commit is contained in:
parent
2d8678b037
commit
67782e30e8
1 changed files with 13 additions and 11 deletions
|
@ -76,6 +76,7 @@ class NoteService
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
//add support for media uploaded as URLs
|
//add support for media uploaded as URLs
|
||||||
|
if (array_key_exists('photo', $data)) {
|
||||||
foreach ($data['photo'] as $photo) {
|
foreach ($data['photo'] as $photo) {
|
||||||
// check the media was uploaded to my endpoint, and use path
|
// check the media was uploaded to my endpoint, and use path
|
||||||
if (starts_with($photo, config('filesystems.disks.s3.url'))) {
|
if (starts_with($photo, config('filesystems.disks.s3.url'))) {
|
||||||
|
@ -89,6 +90,7 @@ class NoteService
|
||||||
}
|
}
|
||||||
$note->media()->save($media);
|
$note->media()->save($media);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$note->save();
|
$note->save();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue