Author: XE Team (developers) (developers@xpressengine.com)
Inheritance: extends Illuminate\Support\Facades\Facade
Exemplo n.º 1
0
 /**
  * Save the application settings.
  *
  * @param SettingRequest $request
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function store(SettingRequest $request)
 {
     // For right now there's only one setting to be saved
     Setting::set('media_path', rtrim(trim($request->input('media_path')), '/'));
     // In a next version we should opt for a "MediaPathChanged" event,
     // but let's just do this async now.
     Media::sync();
     return response()->json();
 }
Exemplo n.º 2
0
 /**
  * Register any other events for your application.
  *
  * @param \Illuminate\Contracts\Events\Dispatcher $events
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     // Generate a unique hash for a song from its path to be the ID
     Song::creating(function ($song) {
         $song->id = Media::getHash($song->path);
     });
     // Remove the cover file if the album is deleted
     Album::deleted(function ($album) {
         if ($album->hasCover) {
             @unlink(app()->publicPath() . '/public/img/covers/' . $album->cover);
         }
     });
 }