This repository has been archived on 2025-07-15. You can view files and clone it, but cannot push or open issues or pull requests.
Files
lean_in_world/app/Http/Controllers/Frontend/LatestNewsController.php
meghamalore eed0ce11d2 first commit
2024-07-04 16:57:26 +05:30

42 lines
1.3 KiB
PHP

<?php
namespace App\Http\Controllers\Frontend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Admin\blog;
use App\Models\Admin\blog_category;
class LatestNewsController extends Controller
{
public function index()
{
// $blog_categ = blog_category::all()->toArray();
$blog_categ = blog_category::latest()->limit(2)->get()->toArray();
$blogs = blog::latest()->get()->toArray();
// dd($blog_categ);
return view('Frontend.Pages.Latest_news.latest_news')->with(['blog'=>$blogs,'blog_categs'=>$blog_categ]);
}
public function blog_detail($id)
{
$blog_three = blog::latest()->limit(3)->get();
$blog = blog::find($id)->toArray();
$blog_categ = blog_category::all()->toArray();
return view('Frontend.Pages.Latest_news.latest_news_detail')->with(['blog'=>$blog,'blog_categs'=>$blog_categ,'latest_blog'=>$blog_three]);
}
public function index_categ($id)
{
$categ_with_blog = blog_category::with('blog')
->where('id',$id)
->get()
->toArray();
// echo "<pre>"; print_r($categ_with_blog);exit;
return view('Frontend.Pages.Latest_news.latest_news_categ')->with(['categ_blog'=>$categ_with_blog]);
}
}