Server IP : 162.213.251.212 / Your IP : 18.220.89.112 [ Web Server : LiteSpeed System : Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : allssztx ( 535) PHP Version : 8.1.31 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/home/allssztx/public_html/easybuyer/app/Http/Controllers/ |
Upload File : |
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use App\Models\Banner; use App\Models\Post; use App\Models\Comment; use App\Models\CommentReplay; use App\Models\User; class BlogController extends Controller { // public function index() { // Banner $data['banner'] = DB::table('banners')->where('banner_id',4)->first(); // CMS $data['sec_1'] = collect(DB::select("SELECT * FROM `cms` WHERE `cms_id` = 4 && `cms_status` = 1"))->first(); // Posts // $data['posts'] = DB::select("SELECT * FROM `posts` WHERE `post_status` = 1 order by `post_id` desc"); $data['posts'] = Post::orderBy('post_id', 'DESC')->get(); // $data['posts'] = Post::latest()->get(); return view('blog',$data); } public function post_detail($id) { // Banner $data['banner'] = DB::table('banners')->where('banner_id',10)->first(); $data['data'] = Post::find($id); $data['comments'] = Comment::where('post_id', $id)->get(); // $data['reply'] = CommentReplay::all(); $data['reply'] = DB::select("SELECT r.`id`, r.`comment_id`, r.`user_id`, r.`comment`, r.`created_at`, u.`name` as userName from `comment_replies` as r left join `users` u on u.`id` = r.`user_id`"); return view('blog_detail',$data); } }