Merge branch 'main' of https://github.com/gyorkistamas/afp1_nagy_ncob
This commit is contained in:
picquiz
app
Http
Controllers
public
images
resources
@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
@ -26,12 +27,12 @@ class UserController extends Controller
|
||||
'email' => ['required', 'email', Rule::unique('users', 'email')],
|
||||
'password' => ['required', 'confirmed', 'min:6']
|
||||
]);
|
||||
|
||||
|
||||
if ($request->hasFile('profile_picture')) {
|
||||
$formFields['profile_picture'] = $request->file('profile_picture')->store('images/uploads/users', 'public');
|
||||
$formFields['profile_picture'] = '/storage/'.$formFields['profile_picture'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$formFields['profile_picture'] = "/images/samplePictures/Sample_User_Icon.png";
|
||||
}
|
||||
@ -76,8 +77,13 @@ class UserController extends Controller
|
||||
}
|
||||
|
||||
//View User:
|
||||
public function view() {
|
||||
return view('users.view');
|
||||
public function view($userID) {
|
||||
|
||||
$User = User::findOrFail($userID);
|
||||
|
||||
return view('users.view', [
|
||||
'User' => $User
|
||||
]);
|
||||
}
|
||||
|
||||
//Show Edit view
|
||||
@ -94,7 +100,7 @@ class UserController extends Controller
|
||||
|
||||
$user = User::find(Auth::User()->id);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($request->get('email') != Auth::User()->email) {
|
||||
@ -104,7 +110,7 @@ class UserController extends Controller
|
||||
$formFields['email'] = $email;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($request->get('password') != '') {
|
||||
$password = $request->validate([
|
||||
@ -116,10 +122,10 @@ class UserController extends Controller
|
||||
|
||||
|
||||
if ($request->hasFile('profile_picture')) {
|
||||
|
||||
|
||||
$formFields['profile_picture'] = $request->file('profile_picture')->store('images/uploads/users', 'public');
|
||||
$user->profile_picture = "/storage/" . $formFields['profile_picture'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!$user) {
|
||||
return abort(404);
|
||||
|
BIN
picquiz/public/images/samplePictures/login_pic.jpg
Normal file
BIN
picquiz/public/images/samplePictures/login_pic.jpg
Normal file
Binary file not shown.
After ![]() (image error) Size: 528 KiB |
BIN
picquiz/public/images/samplePictures/reg_pic.jpg
Normal file
BIN
picquiz/public/images/samplePictures/reg_pic.jpg
Normal file
Binary file not shown.
After ![]() (image error) Size: 263 KiB |
Binary file not shown.
Before ![]() (image error) Size: 29 KiB |
@ -8,7 +8,7 @@
|
||||
|
||||
<section class="vh-100">
|
||||
|
||||
<div class="container h-100">
|
||||
<div class="container h-70">
|
||||
|
||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
||||
|
||||
@ -78,7 +78,7 @@
|
||||
|
||||
<div class="col-md-10 col-lg-6 col-xl-7 d-flex align-items-center order-1 order-lg-2">
|
||||
<!--src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-registration/draw1.webp"-->
|
||||
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-registration/draw1.webp"
|
||||
<img src= {{ asset('images/samplePictures/login_pic.jpg') }}
|
||||
class="img-fluid" alt="Sample image">
|
||||
|
||||
</div>
|
||||
@ -100,4 +100,4 @@
|
||||
|
||||
|
||||
|
||||
@endsection
|
||||
@endsection
|
||||
|
@ -31,15 +31,15 @@
|
||||
|
||||
<i class="fas fa-user fa-lg me-3 fa-fw"></i>
|
||||
<div class="form-outline flex-fill mb-0">
|
||||
|
||||
<input
|
||||
type="file"
|
||||
name="profile_picture"
|
||||
id="profilePictureInput"
|
||||
accept="image/*"
|
||||
|
||||
<input
|
||||
type="file"
|
||||
name="profile_picture"
|
||||
id="profilePictureInput"
|
||||
accept="image/*"
|
||||
class="form-control"
|
||||
>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -48,16 +48,16 @@
|
||||
|
||||
<i class="fas fa-user fa-lg me-3 fa-fw"></i>
|
||||
<div class="form-outline flex-fill mb-0">
|
||||
|
||||
|
||||
<label class="form-label" for="profilePictureInput">Profilkép:</label>
|
||||
<img
|
||||
id="displayProfilePicture"
|
||||
src="{{ asset('images/samplePictures/Sample_User_Icon.png') }}"
|
||||
style="width: 60%; height: 60%; display: block; margin-left: auto; margin-right: auto;"
|
||||
alt="Nincs beállítva"
|
||||
<img
|
||||
id="displayProfilePicture"
|
||||
src="{{ asset('images/samplePictures/Sample_User_Icon.png') }}"
|
||||
style="width: 60%; height: 60%; display: block; margin-left: auto; margin-right: auto;"
|
||||
alt="Nincs beállítva"
|
||||
title="Profilkép"
|
||||
>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -154,7 +154,7 @@
|
||||
|
||||
<div class="col-md-10 col-lg-6 col-xl-7 d-flex align-items-center order-1 order-lg-2">
|
||||
|
||||
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-registration/draw1.webp"
|
||||
<img src={{ asset('images/samplePictures/reg_pic.jpg') }}
|
||||
class="img-fluid" alt="Sample image">
|
||||
|
||||
</div>
|
||||
@ -173,4 +173,4 @@
|
||||
|
||||
</section>
|
||||
|
||||
@endsection
|
||||
@endsection
|
||||
|
@ -1,44 +1,49 @@
|
||||
@extends('template')
|
||||
|
||||
@section('title')
|
||||
<title>{{ Str::title(Auth::User()->username) }} megtekintése</title>
|
||||
{{-- {{ Str::title($User->username) }} --}}
|
||||
<title>Felhasználó megtekintése</title>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<section class="vh-100">
|
||||
<div class="container py-5 h-100">
|
||||
<div class="container h-70">
|
||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
||||
<div class="col-md-12 col-xl-4">
|
||||
|
||||
<div class="card bg-dark text-white" style="border-radius: 15px;">
|
||||
<div class="card-body text-center">
|
||||
<div class="mt-3 mb-4">
|
||||
<img src="{{ asset(Auth::User()->profile_picture) }}"
|
||||
<img src="{{ asset($User->profile_picture) }}"
|
||||
class="rounded-circle img-fluid" style="width: 100px;" />
|
||||
</div>
|
||||
<h4 class="mb-2">{{Auth::User()->username}}</h4>
|
||||
<p class="text-white mb-4">{{Auth::User()->isAdmin == 1 ? '@Adminisztrátor' : '@Felhasználó'}} <span class="mx-2">|</span>
|
||||
<a href="#!">{{Auth::User()->email}}</a>
|
||||
<h4 class="mb-2">{{ $User->username }}</h4>
|
||||
<p class="text-white mb-4">{{ $User->isAdmin == 1 ? '@Adminisztrátor' : '@Felhasználó' }} <span class="mx-2">|</span>
|
||||
<a href="#!">{{ $User->email }}</a>
|
||||
</p>
|
||||
|
||||
<div class="mb-4 pb-2">
|
||||
<p class="mb-2 h5">{{Auth::User()->created_at}}</p>
|
||||
<p class="mb-2 h5">{{ $User->created_at }}</p>
|
||||
<p class="text-white mb-4">Csatlakozás ideje</p>
|
||||
</div>
|
||||
|
||||
{!! $User->id == Auth::User()->id ? "<a class='btn btn-success btn-rounded btn-lg' href='/users/edit'>Profil szerkesztése</a>" : "" !!}
|
||||
{{-- @if ($User->id == Auth::User()->id)
|
||||
<a class="btn btn-success btn-rounded btn-lg" href="/users/edit">Profil szerkesztése</a>
|
||||
@endif --}}
|
||||
|
||||
<div class="d-flex justify-content-between text-center mt-5 mb-2">
|
||||
<div>
|
||||
<p class="mb-2 h5">{{Auth::User()->numberOfGames}}</p>
|
||||
<p class="mb-2 h5">{{ $User->numberOfGames }}</p>
|
||||
<p class="text-white mb-0">Játszmák száma</p>
|
||||
</div>
|
||||
<div class="px-3">
|
||||
<p class="mb-2 h5">{{Auth::User()->numberOfHits}}</p>
|
||||
<p class="mb-2 h5">{{ $User->numberOfHits }}</p>
|
||||
<p class="text-white mb-0">Eltalált feladványok</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="mb-2 h5">{{ Auth::User()->numberOfGames == 0 ? 0 : (Auth::User()->numberOfHits / Auth::User()->numberOfGames) * 100 }} %</p>
|
||||
<p class="mb-2 h5">{{ $User->numberOfGames == 0 ? 0 : ($User->numberOfHits / $User->numberOfGames) * 100 }} %</p>
|
||||
<p class="text-white mb-0">Találati arány</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user