42 lines
1.3 KiB
PHP
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]);
|
|
}
|
|
|
|
|
|
}
|