Skip to content

Commit 5ebc4cf

Browse files
committed
csfix
1 parent 0264805 commit 5ebc4cf

File tree

4 files changed

+67
-4
lines changed

4 files changed

+67
-4
lines changed

app/Http/Controllers/Public/MenuController.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,26 @@
55
namespace Kami\Cocktail\Http\Controllers\Public;
66

77
use Kami\Cocktail\Models\Menu;
8+
use OpenApi\Attributes as OAT;
9+
use Kami\Cocktail\OpenAPI as BAO;
810
use Kami\Cocktail\Http\Controllers\Controller;
911
use Kami\Cocktail\Http\Resources\MenuPublicResource;
1012

1113
class MenuController extends Controller
1214
{
13-
public function show(string $barId): MenuPublicResource
15+
#[OAT\Get(path: '/public/{slugOrId}/menu', tags: ['Public'], operationId: 'showPublicBarMenu', description: 'Show a public bar menu details', summary: 'Show public menu', parameters: [
16+
new OAT\Parameter(name: 'slugOrId', in: 'path', required: true, description: 'Database id or slug of bar', schema: new OAT\Schema(type: 'string')),
17+
], security: [])]
18+
#[BAO\SuccessfulResponse(content: [
19+
new BAO\WrapObjectWithData(MenuPublicResource::class),
20+
])]
21+
#[BAO\NotFoundResponse]
22+
public function show(string $barSlugOrId): MenuPublicResource
1423
{
1524
$menu = Menu::select('menus.*')
16-
->where('bars.id', $barId)
1725
->where('menus.is_enabled', true)
26+
->where('bars.id', $barSlugOrId)
27+
->orWhere('bars.slug', $barSlugOrId)
1828
->join('bars', 'bars.id', '=', 'menus.bar_id')
1929
->join('menu_cocktails', 'menu_cocktails.menu_id', '=', 'menus.id')
2030
->orderBy('menu_cocktails.sort', 'asc')

app/Http/Resources/Public/BarResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function toArray($request)
4141
'subtitle' => $this->subtitle,
4242
'description' => $this->description,
4343
'images' => ImageResource::collection($this->images),
44-
'is_menu_enabled' => $this->menu?->is_enabled ?? false,
44+
'is_menu_enabled' => $this->menu->is_enabled ?? false,
4545
];
4646
}
4747
}

app/Models/Ingredient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function getIngredientsUsedAsSubstituteFor(): Collection
252252
/**
253253
* Return all ingredients that can be substituted with this ingredient
254254
*
255-
* @return Collection<int, $this>
255+
* @return Collection<int, Ingredient>
256256
*/
257257
public function getCanBeSubstitutedWithIngredients(): Collection
258258
{

docs/openapi-generated.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6043,6 +6043,59 @@ paths:
60436043
data: { $ref: '#/components/schemas/APIError' }
60446044
type: object
60456045
security: []
6046+
'/public/{slugOrId}/menu':
6047+
get:
6048+
tags:
6049+
- Public
6050+
summary: 'Show public menu'
6051+
description: 'Show a public bar menu details'
6052+
operationId: showPublicBarMenu
6053+
parameters:
6054+
-
6055+
name: slugOrId
6056+
in: path
6057+
description: 'Database id or slug of bar'
6058+
required: true
6059+
schema:
6060+
type: string
6061+
responses:
6062+
'200':
6063+
description: 'Successful response'
6064+
headers:
6065+
x-ratelimit-limit:
6066+
description: 'Max number of attempts.'
6067+
schema:
6068+
type: integer
6069+
x-ratelimit-remaining:
6070+
description: 'Remaining number of attempts.'
6071+
schema:
6072+
type: integer
6073+
content:
6074+
application/json:
6075+
schema:
6076+
required:
6077+
- data
6078+
properties:
6079+
data: { $ref: '#/components/schemas/MenuPublic' }
6080+
type: object
6081+
'404':
6082+
description: 'Resource record not found.'
6083+
headers:
6084+
x-ratelimit-limit:
6085+
description: 'Max number of attempts.'
6086+
schema:
6087+
type: integer
6088+
x-ratelimit-remaining:
6089+
description: 'Remaining number of attempts.'
6090+
schema:
6091+
type: integer
6092+
content:
6093+
application/json:
6094+
schema:
6095+
properties:
6096+
data: { $ref: '#/components/schemas/APIError' }
6097+
type: object
6098+
security: []
60466099
'/cocktails/{id}/ratings':
60476100
post:
60486101
tags:

0 commit comments

Comments
 (0)