Images can now be uploaded via the media endpoint in a basic way
This commit is contained in:
parent
16015d3f4b
commit
764557b96b
10 changed files with 125 additions and 75 deletions
|
@ -4,11 +4,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Note;
|
||||
use App\Place;
|
||||
use App\Jobs\SendWebMentions;
|
||||
use App\Jobs\SyndicateToTwitter;
|
||||
use App\Jobs\SyndicateToFacebook;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\{Media, Note, Place};
|
||||
use App\Jobs\{SendWebMentions, SyndicateToFacebook, SyndicateToTwitter};
|
||||
|
||||
class NoteService
|
||||
{
|
||||
|
@ -55,6 +54,15 @@ class NoteService
|
|||
}
|
||||
}
|
||||
*/
|
||||
//add support for media uploaded as URLs
|
||||
foreach ($data['photo'] as $photo) {
|
||||
// check the media was uploaded to my endpoint
|
||||
if (starts_with($photo, config('filesystems.disks.s3.url'))) {
|
||||
$path = substr($photo, strlen(config('filesystems.disks.s3.url')));
|
||||
$media = Media::where('path', ltrim($path, '/'))->firstOrFail();
|
||||
$note->media()->save($media);
|
||||
}
|
||||
}
|
||||
|
||||
$note->save();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue