2018-04-29 16:25:57 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2018-08-28 03:07:36 +00:00
|
|
|
use App\Media;
|
|
|
|
use App\Status;
|
|
|
|
use App\User;
|
2018-04-29 16:25:57 +00:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
class AdminController extends Controller
|
|
|
|
{
|
2018-05-26 22:45:05 +00:00
|
|
|
public function __construct()
|
|
|
|
{
|
2018-08-28 03:07:36 +00:00
|
|
|
return $this->middleware('admin');
|
2018-05-26 22:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function home()
|
|
|
|
{
|
2018-08-28 03:07:36 +00:00
|
|
|
return view('admin.home');
|
2018-05-26 22:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function users(Request $request)
|
|
|
|
{
|
2018-08-28 03:07:36 +00:00
|
|
|
$users = User::orderBy('id', 'desc')->paginate(10);
|
2018-05-26 22:45:05 +00:00
|
|
|
|
2018-08-28 03:07:36 +00:00
|
|
|
return view('admin.users.home', compact('users'));
|
|
|
|
}
|
2018-05-26 22:45:05 +00:00
|
|
|
|
|
|
|
public function statuses(Request $request)
|
|
|
|
{
|
2018-08-28 03:07:36 +00:00
|
|
|
$statuses = Status::orderBy('id', 'desc')->paginate(10);
|
|
|
|
|
|
|
|
return view('admin.statuses.home', compact('statuses'));
|
2018-05-26 22:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function showStatus(Request $request, $id)
|
|
|
|
{
|
2018-08-28 03:07:36 +00:00
|
|
|
$status = Status::findOrFail($id);
|
|
|
|
|
|
|
|
return view('admin.statuses.show', compact('status'));
|
2018-05-26 22:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function media(Request $request)
|
|
|
|
{
|
2018-08-28 03:07:36 +00:00
|
|
|
$media = Status::whereHas('media')->orderby('id', 'desc')->paginate(12);
|
|
|
|
|
|
|
|
return view('admin.media.home', compact('media'));
|
2018-05-26 22:45:05 +00:00
|
|
|
}
|
2018-04-29 16:25:57 +00:00
|
|
|
}
|