Skip to content

Commit

Permalink
Merge pull request #24 from karlomikus/develop
Browse files Browse the repository at this point in the history
RC1
  • Loading branch information
karlomikus committed Nov 27, 2022
2 parents bebb9bb + 1b0604d commit 0adc562
Show file tree
Hide file tree
Showing 84 changed files with 687 additions and 157 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- name: Generate key
run: php artisan key:generate

- name: Check coding style
run: vendor/bin/ecs check

- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/phpunit tests/

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/BarExportCocktails.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Kami\Cocktail\Console\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Yaml\Yaml;
use Kami\Cocktail\Models\Cocktail;
use Symfony\Component\Yaml\Yaml;

class BarExportCocktails extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/BarSearchRefresh.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Kami\Cocktail\Console\Commands;

use Illuminate\Console\Command;
use Kami\Cocktail\SearchActions;
use Illuminate\Support\Facades\Artisan;
use Kami\Cocktail\SearchActions;

class BarSearchRefresh extends Command
{
Expand Down
26 changes: 13 additions & 13 deletions app/Console/Commands/OpenBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

namespace Kami\Cocktail\Console\Commands;

use Throwable;
use Illuminate\Support\Str;
use Kami\Cocktail\Models\Tag;
use Illuminate\Console\Command;
use Kami\Cocktail\Models\Image;
use Kami\Cocktail\SearchActions;
use Symfony\Component\Yaml\Yaml;
use Illuminate\Support\Facades\DB;
use Kami\Cocktail\Models\Cocktail;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Hash;
use Kami\Cocktail\Models\Ingredient;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Kami\Cocktail\Models\Cocktail;
use Kami\Cocktail\Models\CocktailIngredient;
use Kami\Cocktail\Models\IngredientCategory;
use Kami\Cocktail\Models\CocktailIngredientSubstitute;
use Kami\Cocktail\Models\Image;
use Kami\Cocktail\Models\Ingredient;
use Kami\Cocktail\Models\IngredientCategory;
use Kami\Cocktail\Models\Tag;
use Kami\Cocktail\SearchActions;
use Symfony\Component\Yaml\Yaml;
use Throwable;

class OpenBar extends Command
{
Expand Down Expand Up @@ -416,7 +416,7 @@ private function importCocktailsFromJson(string $sourcePath)

$cocktail->refresh();
$cocktail->save();
} catch(Throwable $e) {
} catch (Throwable $e) {
DB::rollBack();
}
DB::commit();
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/ScrapIBACocktails.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Kami\Cocktail\Console\Commands;

use Throwable;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpClient\CachingHttpClient;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\HttpKernel\HttpCache\Store;
use Symfony\Component\HttpClient\CachingHttpClient;
use Throwable;

class ScrapIBACocktails extends Command
{
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/TestScrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace Kami\Cocktail\Console\Commands;

use Illuminate\Console\Command;
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpClient\CachingHttpClient;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\HttpKernel\HttpCache\Store;
use Symfony\Component\HttpClient\CachingHttpClient;

class TestScrap extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function schedule(Schedule $schedule)
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->load(__DIR__ . '/Commands');

require base_path('routes/console.php');
}
Expand Down
1 change: 1 addition & 0 deletions app/Exceptions/CocktailException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Exceptions;
Expand Down
4 changes: 2 additions & 2 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Kami\Cocktail\Exceptions;

use Throwable;
use Illuminate\Database\RecordsNotFoundException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\RecordsNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;

class Handler extends ExceptionHandler
{
Expand Down
1 change: 1 addition & 0 deletions app/Exceptions/ImageException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Exceptions;
Expand Down
1 change: 1 addition & 0 deletions app/Exceptions/ImageUploadException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Exceptions;
Expand Down
1 change: 1 addition & 0 deletions app/Exceptions/IngredientException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Exceptions;
Expand Down
7 changes: 4 additions & 3 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;

use Illuminate\Http\Request;
use Kami\Cocktail\Models\User;
use Kami\Cocktail\SearchActions;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Kami\Cocktail\Http\Resources\UserResource;
use Kami\Cocktail\Http\Requests\RegisterRequest;
use Kami\Cocktail\Http\Resources\UserResource;
use Kami\Cocktail\Models\User;
use Kami\Cocktail\SearchActions;

class AuthController extends Controller
{
Expand Down
9 changes: 5 additions & 4 deletions app/Http/Controllers/CocktailController.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;

use Throwable;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Kami\Cocktail\Models\Cocktail;
use Kami\Cocktail\Services\CocktailService;
use Illuminate\Http\Request;
use Kami\Cocktail\Http\Requests\CocktailRequest;
use Kami\Cocktail\Http\Resources\CocktailResource;
use Kami\Cocktail\Http\Resources\SuccessActionResource;
use Kami\Cocktail\Models\Cocktail;
use Kami\Cocktail\Services\CocktailService;
use Throwable;

class CocktailController extends Controller
{
Expand Down
5 changes: 3 additions & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
Expand Down
7 changes: 4 additions & 3 deletions app/Http/Controllers/GlassController.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;

use Illuminate\Http\Response;
use Kami\Cocktail\Models\Glass;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Http\Response;
use Kami\Cocktail\Http\Requests\GlassRequest;
use Kami\Cocktail\Http\Resources\GlassResource;
use Illuminate\Http\Resources\Json\JsonResource;
use Kami\Cocktail\Models\Glass;

class GlassController extends Controller
{
Expand Down
5 changes: 3 additions & 2 deletions app/Http/Controllers/ImageController.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;

use Illuminate\Http\Request;
use Kami\Cocktail\Models\Image;
use Kami\Cocktail\Services\ImageService;
use Kami\Cocktail\Http\Requests\ImageRequest;
use Kami\Cocktail\Http\Resources\ImageResource;
use Kami\Cocktail\Http\Resources\SuccessActionResource;
use Kami\Cocktail\Models\Image;
use Kami\Cocktail\Services\ImageService;

class ImageController extends Controller
{
Expand Down
5 changes: 3 additions & 2 deletions app/Http/Controllers/IngredientCategoryController.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;

use Kami\Cocktail\Models\IngredientCategory;
use Kami\Cocktail\Http\Resources\SuccessActionResource;
use Kami\Cocktail\Http\Requests\IngredientCategoryRequest;
use Kami\Cocktail\Http\Resources\IngredientCategoryResource;
use Kami\Cocktail\Http\Resources\SuccessActionResource;
use Kami\Cocktail\Models\IngredientCategory;

class IngredientCategoryController extends Controller
{
Expand Down
5 changes: 3 additions & 2 deletions app/Http/Controllers/IngredientController.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;

use Illuminate\Http\Request;
use Kami\Cocktail\Models\Ingredient;
use Kami\Cocktail\Services\IngredientService;
use Kami\Cocktail\Http\Requests\IngredientRequest;
use Kami\Cocktail\Http\Resources\IngredientResource;
use Kami\Cocktail\Http\Resources\SuccessActionResource;
use Kami\Cocktail\Models\Ingredient;
use Kami\Cocktail\Services\IngredientService;

class IngredientController extends Controller
{
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/ServerController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;
Expand Down
9 changes: 5 additions & 4 deletions app/Http/Controllers/ShelfController.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;

use Throwable;
use Illuminate\Http\Request;
use Kami\Cocktail\Http\Requests\UserIngredientBatchRequest;
use Kami\Cocktail\Http\Resources\UserIngredientResource;
use Kami\Cocktail\Models\UserIngredient;
use Kami\Cocktail\Models\UserShoppingList;
use Kami\Cocktail\Http\Resources\UserIngredientResource;
use Kami\Cocktail\Http\Requests\UserIngredientBatchRequest;
use Throwable;

class ShelfController extends Controller
{
Expand All @@ -33,7 +34,7 @@ public function save(Request $request, int $ingredientId)
$shelfIngredient = $request->user()->shelfIngredients->where('ingredient_id', $ingredientId)->first();
}

return new UserIngredientResource($shelfIngredient);
return (new UserIngredientResource($shelfIngredient))->response()->setStatusCode(200);
}

public function batch(UserIngredientBatchRequest $request)
Expand Down
7 changes: 4 additions & 3 deletions app/Http/Controllers/ShoppingListController.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;

use Throwable;
use Illuminate\Http\Request;
use Kami\Cocktail\Models\UserShoppingList;
use Illuminate\Http\Resources\Json\JsonResource;
use Kami\Cocktail\Http\Resources\SuccessActionResource;
use Kami\Cocktail\Http\Resources\UserShoppingListResource;
use Kami\Cocktail\Models\UserShoppingList;
use Throwable;

class ShoppingListController extends Controller
{
Expand All @@ -29,7 +30,7 @@ public function batchStore(Request $request): JsonResource
$usl->ingredient_id = $ingId;
try {
$models[] = $request->user()->shoppingLists()->save($usl);
} catch (Throwable $e) {
} catch (Throwable) {
}
}

Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Controllers;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Authenticate extends Middleware
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
if (!$request->expectsJson()) {
return route('login');
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Kami\Cocktail\Http\Middleware;

use Kami\Cocktail\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Kami\Cocktail\Providers\RouteServiceProvider;

class RedirectIfAuthenticated
{
Expand Down
1 change: 1 addition & 0 deletions app/Http/Requests/CocktailRequest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Requests;
Expand Down
1 change: 1 addition & 0 deletions app/Http/Requests/GlassRequest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Requests;
Expand Down
1 change: 1 addition & 0 deletions app/Http/Requests/ImageRequest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Requests;
Expand Down
1 change: 1 addition & 0 deletions app/Http/Requests/IngredientCategoryRequest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Kami\Cocktail\Http\Requests;
Expand Down
Loading

0 comments on commit 0adc562

Please sign in to comment.