diff --git a/app/Http/Controllers/AdminPanelController.php b/app/Http/Controllers/AdminPanelController.php new file mode 100644 index 0000000..aee487a --- /dev/null +++ b/app/Http/Controllers/AdminPanelController.php @@ -0,0 +1,13 @@ + $data['surname'], 'email' => $data['email'], 'password' => Hash::make($data['password']), + 'is_Admin' => false ]); } } diff --git a/app/User.php b/app/User.php index bd7b03e..d7a690e 100644 --- a/app/User.php +++ b/app/User.php @@ -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' ]; /** diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 6f827db..5a04027 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -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(); }); diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 91cb6d1..9a895dc 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -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 + ]); } } diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index c12b97e..4d4bdf3 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -1,5 +1,7 @@ @extends('layouts.app') +@section('title') Login @endsection + @section('content')
diff --git a/resources/views/auth/passwords/confirm.blade.php b/resources/views/auth/passwords/confirm.blade.php index ca78fc1..bc3e5e8 100644 --- a/resources/views/auth/passwords/confirm.blade.php +++ b/resources/views/auth/passwords/confirm.blade.php @@ -1,5 +1,7 @@ @extends('layouts.app') +@section('title') Confirm password @endsection + @section('content')
diff --git a/resources/views/auth/passwords/email.blade.php b/resources/views/auth/passwords/email.blade.php index 1fea984..8edea1c 100644 --- a/resources/views/auth/passwords/email.blade.php +++ b/resources/views/auth/passwords/email.blade.php @@ -1,5 +1,7 @@ @extends('layouts.app') +@section('title') Email @endsection + @section('content')
diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php index 989931d..bbbd065 100644 --- a/resources/views/auth/passwords/reset.blade.php +++ b/resources/views/auth/passwords/reset.blade.php @@ -1,5 +1,7 @@ @extends('layouts.app') +@section('title') Reset password @endsection + @section('content')
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 501a459..20d2637 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -1,5 +1,7 @@ @extends('layouts.app') +@section('title') Register @endsection + @section('content')
diff --git a/resources/views/auth/verify.blade.php b/resources/views/auth/verify.blade.php index 9f8c1bc..639fd3a 100644 --- a/resources/views/auth/verify.blade.php +++ b/resources/views/auth/verify.blade.php @@ -1,5 +1,7 @@ @extends('layouts.app') +@section('title') Verify email @endsection + @section('content')
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 05dfca9..ca0e7f7 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -1,20 +1,20 @@ @extends('layouts.app') +@section('title') Home @endsection + @section('content')
Dashboard
-
@if (session('status')) @endif - - You are logged in! + You are logged in, {{ Auth::user()->name }}
diff --git a/resources/views/layouts/adminpanel.blade.php b/resources/views/layouts/adminpanel.blade.php new file mode 100644 index 0000000..4d00d4d --- /dev/null +++ b/resources/views/layouts/adminpanel.blade.php @@ -0,0 +1,37 @@ +@extends('layouts.app') + +@section('title') Admin Panel @endsection + +@section('content') +
+
+
+ @if (!Auth::user()->is_Admin) +

You are not allowed to see this page.

+ Go somewhere nice + @else +
+
Admin Panel
+
+ @if (session('status')) + + @endif +
+ +
+ @yield('content') +
+
+ @endif +
+
+
+@endsection diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 7bcfd31..c6cf100 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -7,7 +7,7 @@ - {{ config('app.name', 'Laravel') }} + @CHECK | @yield('title') @@ -49,9 +49,14 @@ @endif @else + @if (Auth::user()->is_Admin) + + @endif