mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 22:16:15 +00:00
Setup Inertia (#593)
This commit is contained in:
27
app/Http/Controllers/Settings/ProjectController.php
Normal file
27
app/Http/Controllers/Settings/ProjectController.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Spatie\RouteAttributes\Attributes\Middleware;
|
||||
use Spatie\RouteAttributes\Attributes\Post;
|
||||
use Spatie\RouteAttributes\Attributes\Prefix;
|
||||
|
||||
#[Prefix('settings/projects')]
|
||||
#[Middleware(['auth'])]
|
||||
class ProjectController extends Controller
|
||||
{
|
||||
#[Post('switch/{project}', name: 'projects.switch')]
|
||||
public function switch(Project $project): RedirectResponse
|
||||
{
|
||||
$this->authorize('view', $project);
|
||||
|
||||
user()->update([
|
||||
'current_project_id' => $project->id,
|
||||
]);
|
||||
|
||||
return redirect()->route('servers');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user