shell bypass 403
<?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);
}
}