40 lines
1 KiB
PHP
40 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
use App\Enums\Advices\AdviceTypeEnum;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Advice;
|
|
|
|
class TipsController extends Controller
|
|
{
|
|
/**
|
|
* Tips index View using pagination
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function indexTips(): \Illuminate\Contracts\View\View
|
|
{
|
|
$advices = Advice::query()->with('tags')
|
|
->where('type', AdviceTypeEnum::tips)
|
|
->where('status', true)
|
|
->paginate(9);
|
|
return view('fo.pages.ideas.tips', \compact('advices'));
|
|
}
|
|
|
|
/**
|
|
* Display an advice
|
|
*
|
|
* @param \App\Models\Advice $publishedAdvice
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function show(Advice $publishedAdvice): \Illuminate\Contracts\View\View
|
|
{
|
|
$publishedAdvice->load([
|
|
'advices', 'products.subrange', 'tags'
|
|
]);
|
|
return view('fo.pages.ideas.tip', [
|
|
'adviceModel' => $publishedAdvice
|
|
]);
|
|
}
|
|
}
|