Changes to calling actions() for laravel 11

This commit is contained in:
Deon George 2024-10-01 11:54:34 +10:00
parent a2c71afa73
commit 87ab2729a4

View File

@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use App\Http\Controllers\{PhotoController,VideoController};
use App\Jobs\CatalogDelete; use App\Jobs\CatalogDelete;
/** /**
@ -23,8 +24,8 @@ trait Multimedia
private function controller(string $type): string private function controller(string $type): string
{ {
switch (strtolower($type)) { switch (strtolower($type)) {
case 'photo': return 'PhotoController'; case 'photo': return PhotoController::class;
case 'video': return 'VideoController'; case 'video': return VideoController::class;
default: abort(500,'Type not handled?'); default: abort(500,'Type not handled?');
} }
} }
@ -36,8 +37,8 @@ trait Multimedia
return redirect() return redirect()
->action( ->action(
sprintf('%s@deletes',$this->controller($request->input('type'))), [$this->controller($request->input('type')),'deletes'],
sprintf('?page=%s',$request->input('page')) ['page' => $request->input('page')]
); );
} }
@ -48,8 +49,8 @@ trait Multimedia
return redirect() return redirect()
->action( ->action(
sprintf('%s@duplicates',$this->controller($request->input('type'))), [$this->controller($request->input('type')),'duplicates'],
sprintf('?page=%s',$request->input('page')) ['page' => $request->input('page')]
); );
} }