blogs
This commit is contained in:
@ -11,6 +11,7 @@ use App\Models\Preparation;
|
||||
use App\Models\Service;
|
||||
use App\Models\About;
|
||||
use App\Models\Testimonial;
|
||||
use App\Models\Blog;
|
||||
|
||||
class FrontendController extends Controller
|
||||
{
|
||||
@ -24,7 +25,10 @@ class FrontendController extends Controller
|
||||
$data['testimonials'] = Testimonial::all();
|
||||
// $data['partners'] = Partner::all();
|
||||
// $data['passers'] = Passer::all();
|
||||
// $data['blogs'] = Blog::latest()->take(3)->get();
|
||||
$data['blogs'] = Blog::where('is_published', true)
|
||||
->orderBy('display_order', 'asc')
|
||||
->take(3)
|
||||
->get();
|
||||
|
||||
return view('frontend.home',$data);
|
||||
}
|
||||
@ -33,6 +37,14 @@ class FrontendController extends Controller
|
||||
$posts = Post::all();
|
||||
return view('frontend.about', compact('posts'));
|
||||
}
|
||||
|
||||
public function blogDetails($id)
|
||||
{
|
||||
$blog = Blog::findOrFail($id);
|
||||
$otherBlogs = Blog::where('id', '!=', $id)->latest()->take(5)->get(); // Latest 5 except current
|
||||
return view('frontend.blog-details', compact('blog', 'otherBlogs'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user