Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| DashboardController | |
0.00% |
0 / 9 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| index | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| store | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Controllers; |
| 4 | |
| 5 | use App\Http\Requests\DatabaseRequest; |
| 6 | use App\Services\DatabaseService; |
| 7 | use Illuminate\Http\RedirectResponse; |
| 8 | use Inertia\Inertia; |
| 9 | use Inertia\Response; |
| 10 | |
| 11 | class DashboardController extends Controller |
| 12 | { |
| 13 | public function __construct(private DatabaseService $service) {} |
| 14 | |
| 15 | public function index(): Response |
| 16 | { |
| 17 | $databases = $this->service->index(); |
| 18 | |
| 19 | return Inertia::render('Dashboard', [ |
| 20 | 'databases' => $databases, |
| 21 | ]); |
| 22 | } |
| 23 | |
| 24 | public function store(DatabaseRequest $request): RedirectResponse |
| 25 | { |
| 26 | $result = $this->service->execute($request['databaseSelected']); |
| 27 | |
| 28 | return back()->with([ |
| 29 | 'message' => $result, |
| 30 | ]); |
| 31 | } |
| 32 | } |