25 lines
684 B
PHP
25 lines
684 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Project;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ProjectController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
return view('projects.index');
|
|
}
|
|
|
|
public function show(string $projectName,?string $currentTab = null)
|
|
{
|
|
if($project = Project::firstWhere([['name',$projectName]])) {
|
|
$availableTabs = ['downloads', 'mosaics', 'reports', 'mailings', 'settings'];
|
|
return in_array($currentTab, $availableTabs) ? view('projects.show', compact(['project', 'currentTab'])) : redirect(route('project.show', [$projectName,'downloads']));
|
|
}
|
|
return abort(404);
|
|
}
|
|
|
|
}
|