Skip to content

Commit

Permalink
Create Cocktail controller
Browse files Browse the repository at this point in the history
  • Loading branch information
polekstulod committed Mar 11, 2024
1 parent 05de269 commit 7c251a2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions app/Http/Controllers/CocktailController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Http\Controllers;

use App\Services\CocktailService;

class CocktailController extends Controller
{
protected $cocktailService;

public function __construct(CocktailService $cocktailService)
{
$this->cocktailService = $cocktailService;
}

public function index()
{
$cocktails = $this->cocktailService->getAllCocktails();

return view('cocktails.index', compact('cocktails'));
}

public function show($id)
{
$cocktail = $this->cocktailService->getCocktailDetails($id);

return view('cocktails.show', compact('cocktail'));
}
}

0 comments on commit 7c251a2

Please sign in to comment.