From 43b2c739d7829478a4f0a974423503ee19defe3d Mon Sep 17 00:00:00 2001
From: Conkley
Date: Fri, 24 Jun 2022 14:51:30 +1000
Subject: [PATCH] user list and other fixes
epic
---
app/Http/Controllers/HomeController.php | 3 +
app/Http/Controllers/PageController.php | 15 ++
public/css/app.css | 11 +-
resources/css/app.css | 235 +++++++++++++++++++-----
resources/views/index.blade.php | 7 -
resources/views/layouts/app.blade.php | 9 +-
resources/views/pages/users.blade.php | 37 ++++
routes/web.php | 2 +
8 files changed, 262 insertions(+), 57 deletions(-)
create mode 100644 resources/views/pages/users.blade.php
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index f68452e..e2ddbeb 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -23,6 +23,9 @@ class HomeController extends Controller
*/
public function index()
{
+ if (auth()->user()) {
+ return redirect(route('home'));
+ }
return view('index');
}
diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php
index c8757cc..4901b0d 100644
--- a/app/Http/Controllers/PageController.php
+++ b/app/Http/Controllers/PageController.php
@@ -2,9 +2,11 @@
namespace App\Http\Controllers;
+use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Models\User;
+
class PageController extends Controller
{
/**
@@ -25,9 +27,22 @@ class PageController extends Controller
public function profile($id)
{
$user = User::find($id);
+
if (!$user) {
abort(404);
}
+
return view('pages.profile')->with('user', $user);
}
+
+ public function users(Request $request)
+ {
+ if ($request->has('q')) {
+ $users = DB::table('users')->where('name', 'LIKE', '%'.$request->q.'%')->paginate(10);
+ } else {
+ $users = User::paginate(10);
+ }
+
+ return view('pages.users')->with('users', $users);
+ }
}
diff --git a/public/css/app.css b/public/css/app.css
index 9c09e06..f8dacaa 100644
--- a/public/css/app.css
+++ b/public/css/app.css
@@ -89,7 +89,7 @@ background: linear-gradient(#f07575 10%, #e13b3b 49%, #d22 50%, #de2323 100%);
padding-right: 5px;
width: 50%;
}
-.FeedContainerBox {
+.FeedContainerBox, .ProfileContainerBox {
border-radius: 1px;
text-align: left;
width: 100%;
@@ -97,6 +97,7 @@ background: linear-gradient(#f07575 10%, #e13b3b 49%, #d22 50%, #de2323 100%);
display: inline-flex;
border: 1px solid #000000;
border-width: 1px;
+ margin-bottom: 5px;
}
#btncontainer {
margin-left: 75%;
@@ -294,4 +295,12 @@ a, #navbarusername {
background-color: rgba(255, 255, 255, 0.3);
padding-bottom: 5px;
padding-top: 5px;
+}
+.w-5 {
+ display: none;
+}
+.flex {
+ display: table;
+ margin-right: auto;
+ margin-left: auto;
}
\ No newline at end of file
diff --git a/resources/css/app.css b/resources/css/app.css
index 8479a42..9ca4f76 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -1,8 +1,8 @@
@keyframes animatedbackground {
from {background-position-x: 0px; animation-timing-function: linear;}
to {background-position-x: 2000px; animation-timing-function: linear;}
-}
-#alert {
+ }
+ #alert {
height: fit-content;
margin: 0px;
position: fixed;
@@ -13,9 +13,9 @@
padding-left: 5px;
width: 100%;
text-align: center;
- background: linear-gradient(#f07575 10%, #e13b3b 49%, #d22 50%, #de2323 100%);
-}
-.navbar {
+ background: linear-gradient(#f07575 10%, #e13b3b 49%, #d22 50%, #de2323 100%);
+ }
+ .navbar {
height: 40px;
margin: 0px;
padding-right: 5px;
@@ -30,47 +30,89 @@
vertical-align: middle;
width: 100%;
background: linear-gradient(#759CF0 10%, #3B72E1 49%, #2260DD 50%, #2362DE 100%);
-}
-.navbarbuttoncontainer, .smallnavbarbuttoncontainer, .navbarlogincontainer {
+ }
+ .navbarbuttoncontainer, .smallnavbarbuttoncontainer, .navbarlogincontainer {
padding-left: 5px;
display: table-cell;
vertical-align: middle;
-}
-#navbarlogincontainer, #navbarsignedincontainer {
+ }
+ #navbarlogincontainer, #navbarsignedincontainer {
position: relative;
padding-right: 10px;
margin-right: 3%;
margin-left: auto;
float: inline-end;
top: 11px;
-}
-#profilefriendscontainer p, #profilefriendscontainer a {
+ }
+ #profilefriendscontainer p, #profilefriendscontainer a {
display: inline;
-}
-#profiletopcontainer {
+ }
+ #profiletopcontainer {
margin-bottom: 30px;
display: block;
width: 100%;
-}
-#profilemiddlecontainer {
+ }
+ .onlinestatus_website {
+ color: #2260DD;
+ }
+ .onlinestatus_ingame {
+ color: green;
+ }
+ .onlinestatus_offline {
+ color: black;
+ }
+ #yes, #no {
+ width: 50%;
+ }
+ #FeedBox {
+ width: 100%;
+ height: 22px;
+ }
+ #FeedButton {
+ width: 100%;
+ height: 22px;
+ }
+ #logo_signup, #logo-signup p {
+ margin: auto;
text-align: center;
- margin-right: 50%;
-}
-#btncontainer {
+ width: 200px;
+ }
+ #feed, #profileleftcontainer {
+ text-align: center;
+ padding-left: 5px;
+ padding-right: 5px;
+ width: 50%;
+ }
+ #gamesframe, #profilerightcontainer {
+ text-align: center;
+ padding-left: 5px;
+ padding-right: 5px;
+ width: 50%;
+ }
+ .FeedContainerBox, .ProfileContainerBox {
+ border-radius: 1px;
+ text-align: left;
+ width: 100%;
+ vertical-align: top;
+ display: inline-flex;
+ border: 1px solid #000000;
+ border-width: 1px;
+ }
+ #btncontainer {
margin-left: 75%;
-}
-.navbarbutton {
+ }
+ .navbarbutton {
position: relative;
top: 10px;
text-align: center;
font-size: 18px;
-}
-.smallnavbarbutton {
+ }
+ .smallnavbarbutton {
position: relative;
text-align: center;
font-size: 15px;
-}
-.smallnav {
+ }
+ .smallnav {
height: 25px;
margin: 0px;
padding-left: 5px;
@@ -87,33 +129,42 @@
text-size-adjust: auto;
text-align: left;
background-color: black;
-}
-.invisible {
+ }
+ .invisible, #invisible {
display: none !important;
-}
-html {
+ }
+ html {
margin: 0px;
font-family: "Helvetica";
src: url('Helvetica.ttf') format('truetype'),;
font-style: normal;
- background-color: #2e7eff;
+ background-color: rgb(49, 107, 223);
color: white;
animation-name: animatedbackground;
animation-duration: 50s;
animation-iteration-count: infinite;
- background-image: url(animated.png);
+ background-image: url('../img/animated.png');
background-position: center 100%;
background-repeat: repeat-x;
background-attachment: fixed;
-}
-body {
+ }
+ body {
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
margin-bottom: 35px;
padding-bottom: 0px;
-}
-.content {
+ }
+ .content_special, #content_special {
+ display: inline-flex;
+ width: 100%;
+ flex-wrap: nowrap;
+ flex-direction: row;
+ align-content: center;
+ justify-content: flex-start;
+ align-items: flex-start;
+ }
+ .content {
color: black;
max-width: 1000px;
margin: auto;
@@ -124,11 +175,25 @@ body {
background-color: rgba(255, 255, 255, 0.8);
padding-bottom: 5px;
padding-top: 5px;
-}
-.content p a, .content a {
+ }
+ .content_signup {
+ color: black;
+ max-width: 500px;
+ margin: auto;
+ margin-top: 30px;
+ padding-left: 5px;
+ padding-right: 5px;
+ background-color: rgba(255, 255, 255, 0.8);
+ padding-bottom: 5px;
+ padding-top: 5px;
+ }
+ .content_signup input, .content_signup button {
+ width: 90%;
+ }
+ .content p a, .content a, .content_signup p a, .content_signup a, .content_special p a, .content_special a {
color: black
-}
-#footer {
+ }
+ #footer {
text-align: center;
max-width: 1000px;
margin: auto;
@@ -138,15 +203,95 @@ body {
padding-top: 5px;
background-color: rgba(172, 172, 172, 0.8);
min-height: fit-content;
-}
-#footer p, #footer a {
+ }
+ button {
+ font-weight: 400;
+ text-align: center;
+ border-radius: 3px;
+ border: 1px solid #3D414A;
+ font-family: "Helvetica";
+ color: #fff;
+ }
+ button.bluebutton {
+ background: linear-gradient(#759CF0 10%, #3B72E1 49%, #2260DD 50%, #2362DE 100%);
+ }
+ button:hover.bluebutton {
+ background: linear-gradient(#7ca1ef 10%, #4a7de4 49%, #396fdb 50%, #3168d6 100%);
+ cursor: pointer;
+ }
+ button:disabled.bluebutton {
+ background: linear-gradient(#759CF0 10%, #3B72E1 49%, #2260DD 50%, #2362DE 100%);
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ button.greybutton {
+ background: linear-gradient(#cacbcc 10%, #99999a 49%, #747474 50%, #2d2d2d 100%);
+ }
+ button:hover.greybutton {
+ background: linear-gradient(#d1d8e6 10%, #b3b8c2 49%, #868a91 50%, #393b3e 100%);
+ cursor: pointer;
+ }
+ button:disabled.greybutton {
+ background: linear-gradient(#cacbcc 10%, #99999a 49%, #747474 50%, #2d2d2d 100%);
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ button.redbutton {
+ background: linear-gradient(#e65a5a 10%, #e13535 49%, #d92c2c 50%, #df1818 100%);
+ }
+ button:hover.redbutton {
+ background: linear-gradient(#e56c6c 10%, #dd4e4e 49%, #d14343 50%, #da2e2e 100%);
+ cursor: pointer;
+ }
+ button:disabled.redbutton {
+ background: linear-gradient(#e65a5a 10%, #e13535 49%, #d92c2c 50%, #df1818 100%);
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ button.greenbutton {
+ background: linear-gradient(#5acf77 10%, #3abc44 49%, #359c32 50%, #1a5c2e 100%);
+ }
+ button:hover.greenbutton {
+ background: linear-gradient(#75f094 10%, #39d746 49%, #21b71c 50%, #137a32 100%);
+ cursor: pointer;
+ }
+ button:disabled.greenbutton {
+ background: linear-gradient(#75f094 10%, #39d746 49%, #21b71c 50%, #137a32 100%);
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ #footer_signup {
+ text-align: center;
+ max-width: 500px;
+ margin: auto;
+ padding-left: 5px;
+ padding-right: 5px;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ background-color: rgba(172, 172, 172, 0.8);
+ min-height: fit-content;
+ }
+ #footer p, #footer a, #footer_signup p, #footer_signup a {
color: black;
-}
-p,h1 {
+ }
+ p,h1,h2,h3,h4,h5,h6 {
margin: 0px;
-}
-a, #navbarusername {
+ }
+ a, #navbarusername {
color: white;
text-decoration: none;
font-weight: bolder;
-}
\ No newline at end of file
+ }
+ .nonbolded {
+ font-weight: normal !important;
+ }
+ .logoutframe {
+ color: black;
+ max-width: fit-content;
+ margin: auto;
+ padding-left: 5px;
+ padding-right: 5px;
+ background-color: rgba(255, 255, 255, 0.3);
+ padding-bottom: 5px;
+ padding-top: 5px;
+ }
\ No newline at end of file
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php
index 5412d18..8e8f294 100644
--- a/resources/views/index.blade.php
+++ b/resources/views/index.blade.php
@@ -35,13 +35,6 @@
here!
Also, Join our Discord!
- Page Links
- Home
- Games
- Profile
- 404
- Logout
-
User Count
There are {{ App\Models\User::count() }} users registered
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index 92ce258..3aabe98 100644
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -6,8 +6,8 @@
-
-
+
+
@@ -22,9 +22,9 @@
@yield('alert')
diff --git a/resources/views/pages/users.blade.php b/resources/views/pages/users.blade.php
new file mode 100644
index 0000000..00468a2
--- /dev/null
+++ b/resources/views/pages/users.blade.php
@@ -0,0 +1,37 @@
+@extends('layouts.app')
+@section('title')
+ Users - {{ env('APP_NAME') }}
+@endsection
+
+@section('content')
+ @if (request()->query('q'))
+ Users - {{ DB::table('users')->where('name', 'LIKE', '%'.request()->query('q').'%')->count() }} found
+ Clear Search
+ @else
+ Users
+ @endif
+
+
+
+
+
+ @foreach ($users as $user)
+
+ @endforeach
+
+
+ {{ $users->appends($_GET)->links() }}
+@endsection
diff --git a/routes/web.php b/routes/web.php
index 3a7fb02..08a8914 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -27,4 +27,6 @@ Route::get('/user/{id}', [App\Http\Controllers\PageController::class, 'profile']
Route::middleware(['auth'])->group(function () {
Route::get('/home', [App\Http\Controllers\HomeController::class, 'home'])->name('home');
+ Route::get('/users', [App\Http\Controllers\PageController::class, 'users'])->name('users');
+ Route::post('/users', [App\Http\Controllers\PageController::class, 'users'])->name('users');
});