⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.142
Server IP:
217.76.53.76
Server:
Linux vmi1397931.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
Server Software:
Apache
PHP Version:
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
mydetails.com.ng
/
app
/
Repositories
/
View File Name :
GalleryRepository.php
fieldSearchable; } /** * Configure the Model **/ public function model() { return Gallery::class; } /** * @return mixed */ public function store($input) { try { DB::beginTransaction(); if ($input['type'] == Gallery::TYPE_IMAGE) { $input['link'] = null; } if ($input['type'] == Gallery::TYPE_YOUTUBE) { $input['image'] = null; } if ($input['type'] == Gallery::TYPE_FILE || $input['type'] == Gallery::TYPE_VIDEO || $input['type'] == Gallery::TYPE_AUDIO) { $input['image'] = null; $input['link'] = null; } $gallery = Gallery::create($input); if (($input['type'] == Gallery::TYPE_IMAGE) && isset($input['image']) && ! empty($input['image'])) { $gallery->addMedia($input['image'])->toMediaCollection(Gallery::GALLERY_PATH, config('app.media_disc')); } if (($input['type'] == Gallery::TYPE_FILE) && isset($input['gallery_upload_file']) && ! empty($input['gallery_upload_file'])) { $gallery->addMedia($input['gallery_upload_file'])->toMediaCollection(Gallery::GALLERY_PATH, config('app.media_disc')); } if (($input['type'] == Gallery::TYPE_VIDEO) && isset($input['video_file']) && ! empty($input['video_file'])) { $gallery->addMedia($input['video_file'])->toMediaCollection(Gallery::GALLERY_PATH, config('app.media_disc')); } if (($input['type'] == Gallery::TYPE_AUDIO) && isset($input['audio_file']) && ! empty($input['audio_file'])) { $gallery->addMedia($input['audio_file'])->toMediaCollection(Gallery::GALLERY_PATH, config('app.media_disc')); } DB::commit(); return $gallery; } catch (Exception $e) { DB::rollBack(); throw new UnprocessableEntityHttpException($e->getMessage()); } } /** * @return Builder|Builder[]|Collection|Model */ public function update($input, $id) { try { DB::beginTransaction(); if ($input['type'] == Gallery::TYPE_IMAGE) { $input['link'] = null; } if ($input['type'] == Gallery::TYPE_YOUTUBE) { $input['image'] = null; } if ($input['type'] == Gallery::TYPE_FILE || $input['type'] == Gallery::TYPE_VIDEO || $input['type'] == Gallery::TYPE_AUDIO) { $input['image'] = null; $input['link'] = null; } $gallery = Gallery::findOrFail($id); if (($input['type'] == Gallery::TYPE_IMAGE) && isset($input['image']) && ! empty($input['image'])) { $gallery->clearMediaCollection(Gallery::GALLERY_PATH); $gallery->addMedia($input['image'])->toMediaCollection(Gallery::GALLERY_PATH, config('app.media_disc')); } if (($input['type'] == Gallery::TYPE_FILE) && isset($input['gallery_upload_file']) && ! empty($input['gallery_upload_file'])) { $gallery->clearMediaCollection(Gallery::GALLERY_PATH); $gallery->addMedia($input['gallery_upload_file'])->toMediaCollection(Gallery::GALLERY_PATH, config('app.media_disc')); } if (($input['type'] == Gallery::TYPE_VIDEO) && isset($input['video_file']) && ! empty($input['video_file'])) { $gallery->clearMediaCollection(Gallery::GALLERY_PATH); $gallery->addMedia($input['video_file'])->toMediaCollection(Gallery::GALLERY_PATH, config('app.media_disc')); } if (($input['type'] == Gallery::TYPE_AUDIO) && isset($input['audio_file']) && ! empty($input['audio_file'])) { $gallery->addMedia($input['audio_file'])->toMediaCollection(Gallery::GALLERY_PATH, config('app.media_disc')); } $gallery->update($input); DB::commit(); return $gallery; } catch (Exception $e) { DB::rollBack(); throw new UnprocessableEntityHttpException($e->getMessage()); } } }