phpvms/app/Http/Controllers/Frontend/HomeController.php
Nabeel S 45873431e4
Add public/private pages #641 (#644)
* Add public/private pages #641

* Cleanup the form requests
2020-03-28 13:03:52 -04:00

38 lines
880 B
PHP

<?php
namespace App\Http\Controllers\Frontend;
use App\Contracts\Controller;
use App\Models\User;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Log;
class HomeController extends Controller
{
/**
* Show the application dashboard.
*/
public function index()
{
try {
$users = User::orderBy('created_at', 'desc')->take(4)->get();
} catch (\PDOException $e) {
Log::emergency($e);
return view('system/errors/database_error', [
'error' => $e->getMessage(),
]);
} catch (QueryException $e) {
return view('system/errors/not_installed');
}
// No users
if (!$users) {
return view('system/errors/not_installed');
}
return view('home', [
'users' => $users,
]);
}
}