
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * lint fixes * missing empty lines * translations * fix vue version * #134 - fixes * fix * fix * #134 - fix * fix * fix * #134 - added tests * #134 - fix to translations * #134 - tests * #134 - fix * Update database/factories/ResumeFactory.php Co-authored-by: Krzysztof Rewak <krzysztof.rewak@gmail.com> * #134 - fix * #134 - fix Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl> Co-authored-by: Krzysztof Rewak <krzysztof.rewak@gmail.com>
58 lines
1.5 KiB
PHP
58 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Toby\Infrastructure\Http\Controllers;
|
|
|
|
use Illuminate\Auth\Access\AuthorizationException;
|
|
use Inertia\Response;
|
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
use Toby\Eloquent\Models\Technology;
|
|
use Toby\Infrastructure\Http\Requests\TechnologyRequest;
|
|
use Toby\Infrastructure\Http\Resources\TechnologyResource;
|
|
|
|
class TechnologyController extends Controller
|
|
{
|
|
public function index(): Response
|
|
{
|
|
$this->authorize("manageResumes");
|
|
|
|
$technologies = Technology::query()
|
|
->orderBy("name")
|
|
->get();
|
|
|
|
return inertia("Technologies", [
|
|
"technologies" => TechnologyResource::collection($technologies),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @throws AuthorizationException
|
|
*/
|
|
public function store(TechnologyRequest $request): RedirectResponse
|
|
{
|
|
$this->authorize("manageResumes");
|
|
|
|
$technology = Technology::query()->create($request->data());
|
|
|
|
return redirect()
|
|
->back()
|
|
->with("success", __("Technology :name has been created.", [
|
|
"name" => $technology->name,
|
|
]));
|
|
}
|
|
|
|
public function destroy(Technology $technology): RedirectResponse
|
|
{
|
|
$this->authorize("manageResumes");
|
|
|
|
$technology->delete();
|
|
|
|
return redirect()
|
|
->back()
|
|
->with("success", __("Technology :name has been deleted.", [
|
|
"name" => $technology->name,
|
|
]));
|
|
}
|
|
}
|