blog/app/Http/Controllers/HomeController.php

37 lines
659 B
PHP
Raw Normal View History

2024-02-19 11:07:04 +01:00
<?php
namespace App\Http\Controllers;
use App\Models\BlogPost;
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()
{
// $this->middleware('auth');
2024-02-19 11:07:04 +01:00
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
$tags = Tag::limit(5)->get();
$posts = BlogPost::all();
return view('home', [
'posts' => $posts,
'tags' => $tags
]);
2024-02-19 11:07:04 +01:00
}
}