2021-07-16 02:35:54 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
2021-07-26 22:39:11 -04:00
|
|
|
use App\Models\Meme;
|
2021-07-16 02:35:54 -04:00
|
|
|
|
|
|
|
class DashboardController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Create a new controller instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->middleware('auth');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the application dashboard.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
2021-07-26 22:39:11 -04:00
|
|
|
if (\Auth::user()->is_admin === 1) {
|
|
|
|
$memes_pending = Meme::withoutGlobalScope('approved')->where('is_approved', 0)->get();
|
|
|
|
}
|
|
|
|
$data = [
|
|
|
|
'memes_pending' => $memes_pending ?? null,
|
|
|
|
];
|
|
|
|
return view('dashboard', ['data' => $data]);
|
2021-07-16 02:35:54 -04:00
|
|
|
}
|
|
|
|
}
|