2022-11-14 15:43:56 +01:00
|
|
|
<?php
|
|
|
|
|
|
2022-12-06 17:29:48 +01:00
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
|
|
2023-01-11 13:04:46 +01:00
|
|
|
use App\Enums\Advices\AdviceTypeEnum;
|
2022-12-06 17:29:48 +01:00
|
|
|
use App\Http\Controllers\Controller;
|
2023-01-10 17:29:22 +01:00
|
|
|
use App\Models\Advice;
|
2022-11-14 15:43:56 +01:00
|
|
|
|
|
|
|
|
class TipsController extends Controller
|
|
|
|
|
{
|
2023-01-11 13:04:46 +01:00
|
|
|
/**
|
|
|
|
|
* Tips index View using pagination
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
*/
|
|
|
|
|
public function indexTips()
|
|
|
|
|
{
|
|
|
|
|
$advices = Advice::query()->with('tags')
|
|
|
|
|
->where('type', AdviceTypeEnum::tips())
|
|
|
|
|
->where('status', true)
|
|
|
|
|
->paginate(9);
|
|
|
|
|
return view('fo.pages.ideas.tips', \compact('advices'));
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-14 15:43:56 +01:00
|
|
|
/**
|
2023-01-10 17:29:22 +01:00
|
|
|
* Display an advice
|
2022-11-14 15:43:56 +01:00
|
|
|
*
|
2023-01-10 17:29:22 +01:00
|
|
|
* @param \App\Models\Advice $publishedAdvice
|
|
|
|
|
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
2022-11-14 15:43:56 +01:00
|
|
|
*/
|
2023-01-10 17:29:22 +01:00
|
|
|
public function show(Advice $publishedAdvice)
|
2022-11-14 15:43:56 +01:00
|
|
|
{
|
2023-01-10 17:29:22 +01:00
|
|
|
$publishedAdvice->load([
|
|
|
|
|
'advices', 'products.subrange', 'tags'
|
|
|
|
|
]);
|
|
|
|
|
return view('fo.pages.ideas.tip', [
|
|
|
|
|
'adviceModel' => $publishedAdvice
|
|
|
|
|
]);
|
2022-11-14 15:43:56 +01:00
|
|
|
}
|
|
|
|
|
}
|