2024-02-19 11:07:04 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2024-03-18 18:00:16 -07:00
|
|
|
use App\Models\Post;
|
2024-03-04 15:37:29 +01:00
|
|
|
use App\Models\Tag;
|
2024-02-19 11:07:04 +01:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Create a new controller instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
2024-03-04 12:04:45 +01:00
|
|
|
// $this->middleware('auth');
|
2024-02-19 11:07:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the application dashboard.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
2024-03-04 15:37:29 +01:00
|
|
|
$tags = Tag::limit(5)->get();
|
2024-03-18 18:00:16 -07:00
|
|
|
$posts = Post::all()->reverse();
|
2024-03-04 15:37:29 +01:00
|
|
|
|
2024-03-04 12:04:45 +01:00
|
|
|
return view('home', [
|
2024-03-04 15:37:29 +01:00
|
|
|
'posts' => $posts,
|
|
|
|
'tags' => $tags
|
2024-03-04 12:04:45 +01:00
|
|
|
]);
|
2024-02-19 11:07:04 +01:00
|
|
|
}
|
|
|
|
}
|