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