35 lines
989 B
PHP
35 lines
989 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Solution;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class SolutionsController extends Controller
|
|
{
|
|
public function index(Request $request): View
|
|
{
|
|
$power = $request->query('power');
|
|
$application = $request->query('application');
|
|
$platform = $request->query('platform');
|
|
|
|
$solutions = Solution::published()
|
|
->when($power, fn ($q) => $q->where('power_segment', $power))
|
|
->when($application, fn ($q) => $q->where('application', $application))
|
|
->when($platform, fn ($q) => $q->where('chip_platform', $platform))
|
|
->get();
|
|
|
|
return view('solutions.index', compact('solutions', 'power', 'application', 'platform'));
|
|
}
|
|
|
|
public function show(Solution $solution): View
|
|
{
|
|
if ($solution->status !== 'published') {
|
|
abort(404);
|
|
}
|
|
|
|
return view('solutions.show', compact('solution'));
|
|
}
|
|
}
|