adding Projects feature (#85)

This commit is contained in:
Saeed Vaziry
2024-01-02 19:50:49 +01:00
committed by GitHub
parent fd2244d382
commit 10a6bb57a8
32 changed files with 847 additions and 84 deletions

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers;
use App\Models\Project;
use App\Models\User;
use Illuminate\Contracts\View\View;
class ProjectController extends Controller
{
public function index(): View
{
return view('projects.index');
}
public function switch($projectId)
{
/** @var User $user */
$user = auth()->user();
/** @var Project $project */
$project = $user->projects()->findOrFail($projectId);
$user->current_project_id = $project->id;
$user->save();
return redirect()->route('servers');
}
}