From 6c5dd9eae981e4c24486513a1ef916bd299afaa0 Mon Sep 17 00:00:00 2001 From: Anatoliy Poloz Date: Tue, 26 Dec 2023 13:28:01 +0300 Subject: [PATCH] make recipes visible in public (with out of auth) --- resources/views/recipe/show.blade.php | 319 +++++++++++++------------- routes/web.php | 4 +- 2 files changed, 161 insertions(+), 162 deletions(-) diff --git a/resources/views/recipe/show.blade.php b/resources/views/recipe/show.blade.php index e44f5ce..2a3c5c5 100644 --- a/resources/views/recipe/show.blade.php +++ b/resources/views/recipe/show.blade.php @@ -2,172 +2,171 @@ @section('page_title', 'Recipe ' . $recipe->title) @php - $recipeViewsCount = views($recipe) - ->unique() - ->count(); +$recipeViewsCount = views($recipe) +->unique() +->count(); $isRecipeNavigationUrlActive = true; @endphp @section('main_section') -
-
-
- - Рецепты - -
-
- {{ $recipeViewsCount }} -
-
- @livewire('recipe.like-count', ['recipe' => $recipe]) -
-
- {{ $recipe->comments_count }} -
+
+
+
+ + Рецепты + +
+
+ {{ $recipeViewsCount }}
-
-
- {{ $author['name'] }} -
-
- @empty($author->profile_photo_path) - thumb - @else - thumb - @endempty -
+
+ @livewire('recipe.like-count', ['recipe' => $recipe]) +
+
+ {{ $recipe->comments_count }} +
+
+
+
+ {{ $author['name'] }} +
+
+ @empty($author->profile_photo_path) + thumb + @else + thumb + @endempty
-
-
-
-
-
-
- recipe -
-
-
-

- {{ $recipe->title }} -

- -
- - -
    -
  • - Редактировать -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • - {{--
  • --}} - {{--
    ID: 2jkfk45JG
    --}} - {{--
  • --}} -
- -
- -
-
-
{{ __('recipe.t' . $recipe->cooking_time . 'm') }}
-
{{ $recipe->steps->count() }} этапов
-
-

{!! $recipe->description !!}

- @if (strlen(trim($recipe->video_url)) > 4) - Посмотреть рецепт на YouTube - @endif -
+
+
+
+
+
+
+
+ recipe
-
-
-
- ПРОДУКТЫ: +
+
+

+ {{ $recipe->title }} +

+ +
+ + +
    +
  • + Редактировать +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + {{--
  • --}} + {{--
    ID: 2jkfk45JG
    --}} + {{--
  • --}} +
+ +
+ +
+
+
{{ __('recipe.t' . $recipe->cooking_time . 'm') }}
+
{{ $recipe->steps->count() }} этапов
+
+

{!! $recipe->description !!}

+ @if (strlen(trim($recipe->video_url)) > 4) + Посмотреть рецепт на YouTube + @endif +
+
+
+
+
+ ПРОДУКТЫ:
    - @foreach ($recipe->ingredients as $ingredient) - @php - $localizedUnit = isset($ingredient['unit']) && mb_strlen($ingredient['unit']) > 1 ? $ingredient['unit'] : 'gr'; - @endphp - @if (mb_strlen($ingredient['name']) > 1) -
  • {{ $ingredient['name'] }} - {{ $ingredient['portion'] }} - {{ __('recipe.' . $localizedUnit) }}
  • - @endif - @endforeach -
+ @foreach ($recipe->ingredients as $ingredient) + @php + $localizedUnit = isset($ingredient['unit']) && mb_strlen($ingredient['unit']) > 1 ? $ingredient['unit'] : 'gr'; + @endphp + @if (mb_strlen($ingredient['name']) > 1) +
  • {{ $ingredient['name'] }} - {{ $ingredient['portion'] }} + {{ __('recipe.' . $localizedUnit) }} +
  • + @endif + @endforeach + +
    +
    +
    + ЦЕННОСТЬ:
    -
    -
    - ЦЕННОСТЬ: -
    -
      -
    • WIP
    • - {{-- +
        +
      • WIP
      • + {{--
      • Калории: 139.9 ккал
      • Белки: 20.4 гр
      • Жиры: 5.7 гр
      • Углеводы: 1.8 гр
      • --}} -
      -
    -
    -
    - ЦЕННОСТЬ: -
    -
    - @foreach ($recipe->tags->unique() as $curTag) - {{ $curTag->name }} - @endforeach -
    -
    +
    - +
    -
    -
    -
    -

    - ПОШАГОВЫЙ ФОТО РЕЦЕПТ - {{ $recipe->title }} -

    -
      - @foreach ($recipe->steps as $step) -
    1. -
      - @if (isset($step['image']) && is_string($step['image']) && strlen($step['image']) > 4) - step - @endif -
      -
      - - {!! $step['description'] !!} - -
      -
    2. - @endforeach +
    +
    +
    +
    +

    + ПОШАГОВЫЙ ФОТО РЕЦЕПТ - {{ $recipe->title }} +

    +
      + @foreach ($recipe->steps as $step) +
    1. +
      + @if (isset($step['image']) && is_string($step['image']) && strlen($step['image']) > 4) + step + @endif +
      +
      + + {!! $step['description'] !!} + +
      +
    2. + @endforeach - {{--
    3. + {{--
    4. step
      @@ -188,22 +187,20 @@ $isRecipeNavigationUrlActive = true;

    --}} - -
    -
    - -
    -
    -

    - ОТЗЫВЫ -

    - - @livewire('recipe.comment.show', ['recipe' => $recipe]) - @livewire('recipe.comment.create', ['recipe' => $recipe, 'user' => Auth::user()]) -
    - - -
    + + + +
    +
    +

    + ОТЗЫВЫ +

    + @livewire('recipe.comment.show', ['recipe' => $recipe]) + @auth + @livewire('recipe.comment.create', ['recipe' => $recipe, 'user' => Auth::user()]) + @endauth +
    +
    @endsection diff --git a/routes/web.php b/routes/web.php index d23fef8..0ff8918 100644 --- a/routes/web.php +++ b/routes/web.php @@ -68,6 +68,8 @@ Route::group( Route::get('/registration/{step}', Registration\Step1::class)->name('register.step1'); Route::get('/plan/{plan}', [PlanController::class,'show'])->name('plan.show'); Route::get('/plan/', [PlanController::class,'index'])->name('plan.index'); + Route::get('/recipe/{recipe}', [RecipeController::class,'show'])->name('recipe.show'); + Route::get('/recipe/', [RecipeController::class,'index'])->name('recipe.index'); Route::middleware( [ @@ -94,7 +96,7 @@ Route::group( Route::resource('plan', PlanController::class)->only(['create', 'edit']); Route::resource('diet', DietController::class)->only(['create', 'show', 'index', 'edit']); Route::resource('consultants', ConsultantController::class)->only(['index']); - Route::resource('recipe', RecipeController::class)->only(['create', 'show', 'index', 'edit']); + Route::resource('recipe', RecipeController::class)->only(['create', 'edit']); Route::resource('blog_post', BlogPostController::class)->only(['create', 'show', 'index', 'edit']); Route::resource('product_nutritional_value', ProductNutritionalValueController::class)->only(['create', 'show', 'index', 'edit']); Route::resource('consultant_request', ConsultantRequestFormController::class)