admin panel view added, db seed created, titles for pages added

This commit is contained in:
s416422 2019-11-30 21:32:42 +01:00
parent fc6faa7805
commit d62e97ac42
15 changed files with 87 additions and 8 deletions

View File

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class AdminPanelController extends Controller
{
public function index()
{
return view('layouts.adminpanel');
}
}

View File

@ -69,6 +69,7 @@ class RegisterController extends Controller
'surname' => $data['surname'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'is_Admin' => false
]);
}
}

View File

@ -16,7 +16,7 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
'name', 'surname', 'email', 'password',
'name', 'surname', 'email', 'password', 'is_Admin',
];
/**
@ -25,7 +25,7 @@ class User extends Authenticatable
* @var array
*/
protected $hidden = [
'password', 'remember_token',
'password', 'remember_token'
];
/**

View File

@ -20,6 +20,7 @@ class CreateUsersTable extends Migration
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->boolean('is_Admin');
$table->rememberToken();
$table->timestamps();
});

View File

@ -11,6 +11,12 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// $this->call(UsersTableSeeder::class);
DB::table('users')->insert([
'name' => 'admin',
'surname' => 'main',
'email' => 'admin@admin.com',
'password' => bcrypt('pass1234'),
'is_Admin' => true
]);
}
}

View File

@ -1,5 +1,7 @@
@extends('layouts.app')
@section('title') Login @endsection
@section('content')
<div class="container">
<div class="row justify-content-center">

View File

@ -1,5 +1,7 @@
@extends('layouts.app')
@section('title') Confirm password @endsection
@section('content')
<div class="container">
<div class="row justify-content-center">

View File

@ -1,5 +1,7 @@
@extends('layouts.app')
@section('title') Email @endsection
@section('content')
<div class="container">
<div class="row justify-content-center">

View File

@ -1,5 +1,7 @@
@extends('layouts.app')
@section('title') Reset password @endsection
@section('content')
<div class="container">
<div class="row justify-content-center">

View File

@ -1,5 +1,7 @@
@extends('layouts.app')
@section('title') Register @endsection
@section('content')
<div class="container">
<div class="row justify-content-center">

View File

@ -1,5 +1,7 @@
@extends('layouts.app')
@section('title') Verify email @endsection
@section('content')
<div class="container">
<div class="row justify-content-center">

View File

@ -1,20 +1,20 @@
@extends('layouts.app')
@section('title') Home @endsection
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Dashboard</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
You are logged in!
You are logged in, {{ Auth::user()->name }}
</div>
</div>
</div>

View File

@ -0,0 +1,37 @@
@extends('layouts.app')
@section('title') Admin Panel @endsection
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
@if (!Auth::user()->is_Admin)
<p> You are not allowed to see this page. </p>
<a href="{{ route('home') }}"> Go somewhere nice </a>
@else
<div class="card">
<div class="card-header">Admin Panel</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
</div>
<div class="card-body">
<a href="{{ route('home') }}"> Users </a>
<a href="{{ route('home') }}"> Subjects </a>
<a href="{{ route('home') }}"> Rooms </a>
<a href="{{ route('home') }}"> Classes </a>
<a href="{{ route('home') }}"> Attendances </a>
</div>
<div class="card-body">
@yield('content')
</div>
</div>
@endif
</div>
</div>
</div>
@endsection

View File

@ -7,7 +7,7 @@
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<title>@CHECK | @yield('title')</title>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
@ -49,9 +49,14 @@
</li>
@endif
@else
@if (Auth::user()->is_Admin)
<li class="nav-item">
<a class="nav-link" href="{{ url('/admin') }}">{{ __('Admin panel') }}</a>
</li>
@endif
<li class="nav-item dropdown">
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
{{ Auth::user()->name }} <span class="caret"></span>
{{ Auth::user()->name }} {{ Auth::user()->surname }} <span class="caret"></span>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">

View File

@ -14,7 +14,11 @@
Route::get('/', function () {
return view('welcome');
});
Route::get('/admin', function () {
return view('adminpanel');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/admin', 'AdminPanelController@index')->name('admin');