authorize('admin-access'); /** @var UploadedFile $photoFile */ $photoFile = UploadedFile::createFromBase($request->files->get('photo')); // Load the linked album $album = AlbumController::loadAlbum($request->get('album_id')); $storageLocation = sprintf('albums/%s', $album->url_alias); /** @var \SplFileInfo $savedFile */ $savedFilePath = $photoFile->store($storageLocation, $album->getUploadDisk()); $photo = new Photo(); $photo->album_id = $album->id; $photo->name = $photoFile->getClientOriginalName(); $photo->file_name = basename($savedFilePath); $photo->mime_type = $photoFile->getClientMimeType(); $photo->file_size = $photoFile->getSize(); $photo->save(); $upload = new Upload(); $upload->is_completed = false; $upload->is_processing = false; $upload->number_photos = 1; $upload->save(); $uploadPhoto = new UploadPhoto(); $uploadPhoto->upload_id = $upload->id; $uploadPhoto->photo_id = $photo->id; $uploadPhoto->save(); exit(); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } }