| Total Complexity | 4 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class AdminController extends Controller |
||
| 16 | { |
||
| 17 | 26 | public function __construct() |
|
| 18 | { |
||
| 19 | // Only Authorized users with specific admin permissions are allowed |
||
| 20 | 26 | $this->middleware(['auth', 'can:allow_admin']); |
|
| 21 | 26 | } |
|
| 22 | |||
| 23 | // Admin landing page |
||
| 24 | 10 | public function index() |
|
| 28 | } |
||
| 29 | |||
| 30 | // Display all file links |
||
| 31 | 2 | public function userLinks() |
|
| 32 | { |
||
| 33 | 2 | $userLinks = new UserCollection( |
|
| 34 | 2 | User::where('active', 1) |
|
| 35 | 2 | ->withCount([ |
|
| 36 | 2 | 'FileLinks', |
|
| 37 | 'FileLinks as expired_file_links_count' => function($query) |
||
| 38 | { |
||
| 39 | 2 | $query->where('expire', '<', Carbon::now()); |
|
| 40 | 2 | } |
|
| 41 | ]) |
||
| 42 | 2 | ->get() |
|
| 43 | 2 | ->makeVisible('user_id') |
|
| 44 | ); |
||
| 45 | |||
| 46 | 2 | Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
| 47 | 2 | return view('admin.userLinks', [ |
|
| 48 | 2 | 'links' => $userLinks, |
|
| 49 | ]); |
||
| 50 | } |
||
| 51 | |||
| 52 | // Show the links for the selected user |
||
| 53 | 2 | public function showLinks($id) |
|
| 60 | // 'name' => $userName |
||
| 61 | ]); |
||
| 62 | } |
||
| 64 |