2022-11-08 15:13:56 +01:00
|
|
|
<?php
|
|
|
|
|
|
2022-12-06 17:29:48 +01:00
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
2023-01-06 09:30:41 +01:00
|
|
|
use App\Models\News;
|
|
|
|
|
use App\Models\NewsCategory;
|
2022-11-08 15:13:56 +01:00
|
|
|
|
|
|
|
|
class NewsController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Undocumented function
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
*/
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
2023-01-06 09:30:41 +01:00
|
|
|
// Get NewsCategories.
|
|
|
|
|
$categories = NewsCategory::all();
|
|
|
|
|
|
2023-01-11 09:10:03 +01:00
|
|
|
// Get News.
|
2023-01-06 09:30:41 +01:00
|
|
|
$news = News::paginate(3);
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.news.index', compact('categories', 'news'));
|
2022-11-08 15:13:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Undocumented function
|
2023-01-06 09:30:41 +01:00
|
|
|
* @param News $news
|
2022-11-08 15:13:56 +01:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
*/
|
2023-01-06 09:30:41 +01:00
|
|
|
public function show(News $news)
|
2022-11-08 15:13:56 +01:00
|
|
|
{
|
2023-01-06 09:30:41 +01:00
|
|
|
$news->load('categories', 'news.categories', 'products');
|
|
|
|
|
return view('fo.pages.news.post', compact('news'));
|
2022-11-08 15:13:56 +01:00
|
|
|
}
|
|
|
|
|
}
|