Added Production build.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Post;
|
||||
use App\Models\Status;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class IndexController extends Controller
|
||||
{
|
||||
public function index() {
|
||||
|
||||
if(auth()->user()) {
|
||||
$posts = Post::wherehas("status", function ($query) {
|
||||
$query->where("name", "!=", "Pending")
|
||||
->orWhere("user_id", "=", auth()->id());
|
||||
})->get();
|
||||
|
||||
return view('index')->with("posts", $posts);
|
||||
}
|
||||
|
||||
$posts = Post::wherehas("status", function ($query) {
|
||||
$query->where("name", "!=", "Pending");
|
||||
})->get();
|
||||
|
||||
// $posts = Post::all();
|
||||
|
||||
return view('index')->with("posts", $posts);
|
||||
}
|
||||
|
||||
public function adminIndex(Request $request) {
|
||||
$posts = Post::all();
|
||||
|
||||
if($request->get("type") != null) {
|
||||
$posts = Post::wherehas("status", function ($query) {
|
||||
$query->where("name", "=", "Pending");
|
||||
})->get();
|
||||
}
|
||||
|
||||
return view('admin.posts')->with("posts", $posts);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user