From e748ade496ee7828ebdce145cd70d0062a3184af Mon Sep 17 00:00:00 2001 From: s416422 Date: Sun, 1 Dec 2019 19:31:49 +0100 Subject: [PATCH] Admin panel created --- .../Admin/AdminAttendancesController.php | 50 +++++ .../Admin/AdminClassesController.php | 44 +++++ .../Admin/AdminPanelController.php | 14 ++ .../Admin/AdminRoomsController.php | 45 +++++ .../Admin/AdminSubjectsController.php | 55 ++++++ .../Admin/AdminUsersController.php | 40 ++++ app/Http/Controllers/AdminPanelController.php | 122 ------------ app/Subject.php | 2 +- ...2019_11_26_232020_create_classes_table.php | 2 +- ...019_11_26_232906_create_subjects_table.php | 6 +- .../2019_11_26_232945_create_rooms_table.php | 2 +- ..._11_26_233012_create_attendances_table.php | 2 +- database/seeds/DatabaseSeeder.php | 31 +++ database/seeds/RoomsTableSeeder.php | 73 +++++++ .../views/admin/admin_attendances.blade.php | 158 ++++++++++++--- resources/views/admin/admin_classes.blade.php | 99 +++++++--- resources/views/admin/admin_rooms.blade.php | 109 ++++++++--- .../views/admin/admin_subjects.blade.php | 183 +++++++++++++++--- resources/views/admin/admin_users.blade.php | 67 ++++--- resources/views/auth/register.blade.php | 2 +- resources/views/layouts/adminpanel.blade.php | 54 +++--- resources/views/layouts/app.blade.php | 6 +- routes/web.php | 43 ++-- 23 files changed, 881 insertions(+), 328 deletions(-) create mode 100644 app/Http/Controllers/Admin/AdminAttendancesController.php create mode 100644 app/Http/Controllers/Admin/AdminClassesController.php create mode 100644 app/Http/Controllers/Admin/AdminPanelController.php create mode 100644 app/Http/Controllers/Admin/AdminRoomsController.php create mode 100644 app/Http/Controllers/Admin/AdminSubjectsController.php create mode 100644 app/Http/Controllers/Admin/AdminUsersController.php delete mode 100644 app/Http/Controllers/AdminPanelController.php create mode 100644 database/seeds/RoomsTableSeeder.php diff --git a/app/Http/Controllers/Admin/AdminAttendancesController.php b/app/Http/Controllers/Admin/AdminAttendancesController.php new file mode 100644 index 0000000..1743f2a --- /dev/null +++ b/app/Http/Controllers/Admin/AdminAttendancesController.php @@ -0,0 +1,50 @@ + $attendances, 'classes' => $classes]); + } + + public function add_attendance(Request $request) + { + $classes_id = $request->input('classes_id'); + $student_id_number = $request->input('student_id'); + $student_name = $request->input('student_name'); + $student_surname = $request->input('student_surname'); + $seat_number = $request->input('seat_number'); + Attendance::create([ + 'classes_id' => $classes_id, + 'student_id_number' => $student_id_number, + 'student_name' => $student_name, + 'student_surname' => $student_surname, + 'seat_number' => $seat_number, + ]); + return redirect(route('admin_attendances')); + } + + public function delete_attendance($attendance_id) + { + Attendance::find($attendance_id)->delete(); + return redirect(route('admin_attendances')); + } + + public function edit_attendance($attendance_id) + { + Attendance::find($attendance_id); + return redirect(route('admin_attendances')); + } +} diff --git a/app/Http/Controllers/Admin/AdminClassesController.php b/app/Http/Controllers/Admin/AdminClassesController.php new file mode 100644 index 0000000..41431b6 --- /dev/null +++ b/app/Http/Controllers/Admin/AdminClassesController.php @@ -0,0 +1,44 @@ + $classes, 'subjects' => $subjects]); + } + + public function add_classes(Request $request) + { + $subject_id = $request->input('subject_id'); + $date = $request->input('date'); + Classes::create([ + 'subject_id' => $subject_id, + 'date' => $date + ]); + return redirect(route('admin_classes')); + } + + public function delete_classes($classes_id) + { + Classes::find($classes_id)->delete(); + return redirect(route('admin_classes')); + } + + public function edit_classes($classes_id) + { + Classes::find($classes_id); + return redirect(route('admin_classes')); + } +} diff --git a/app/Http/Controllers/Admin/AdminPanelController.php b/app/Http/Controllers/Admin/AdminPanelController.php new file mode 100644 index 0000000..19a5c69 --- /dev/null +++ b/app/Http/Controllers/Admin/AdminPanelController.php @@ -0,0 +1,14 @@ + $rooms]); + } + + public function add_room(Request $request) + { + $name = $request->input('name'); + $capacity = $request->input('capacity'); + $arrangement = $request->input('arrangement'); + Room::create([ + 'name' => $name, + 'capacity' => $capacity, + 'arrangement' => $arrangement + ]); + return redirect(route('admin_rooms')); + } + + public function delete_room($room_id) + { + Room::find($room_id)->delete(); + return redirect(route('admin_rooms')); + } + + public function edit_room($room_id) + { + Room::find($room_id); + return redirect(route('admin_rooms')); + } +} diff --git a/app/Http/Controllers/Admin/AdminSubjectsController.php b/app/Http/Controllers/Admin/AdminSubjectsController.php new file mode 100644 index 0000000..d075c2b --- /dev/null +++ b/app/Http/Controllers/Admin/AdminSubjectsController.php @@ -0,0 +1,55 @@ + $subjects, 'users' => $users, 'rooms' => $rooms, 'weekdays' => $weekdays, 'types' => $types]); + } + + public function add_subject(Request $request) + { + $name = $request->input('name'); + $type = $request->input('type'); + $weekday = $request->input('weekday'); + $time = $request->input('time'); + $room_id = $request->input('room_id'); + $user_id = $request->input('user_id'); + Subject::create([ + 'name' => $name, + 'type' => $type, + 'weekday'=> $weekday, + 'time' => $time, + 'room_id' => $room_id, + 'user_id' => $user_id + ]); + return redirect(route('admin_subjects')); + } + + public function delete_subject($subject_id) + { + Subject::find($subject_id)->delete(); + return redirect(route('admin_subjects')); + } + + public function edit_subject($subject_id) + { + Subject::find($subject_id); + return redirect(route('admin_subjects')); + } +} diff --git a/app/Http/Controllers/Admin/AdminUsersController.php b/app/Http/Controllers/Admin/AdminUsersController.php new file mode 100644 index 0000000..8b45ac0 --- /dev/null +++ b/app/Http/Controllers/Admin/AdminUsersController.php @@ -0,0 +1,40 @@ + $users]); + } + + public function add_user(Request $request) + { + $name = $request->input('name'); + $surname = $request->input('surname'); + $id_number = $request->input('id_number'); + return redirect(route('admin_users')); + } + + public function delete_user($user_id) + { + User::find($user_id)->delete(); + return redirect(route('admin_users')); + } + + public function edit_user($user_id) + { + User::find($user_id); + return redirect(route('admin_users')); + } +} diff --git a/app/Http/Controllers/AdminPanelController.php b/app/Http/Controllers/AdminPanelController.php deleted file mode 100644 index afb49f0..0000000 --- a/app/Http/Controllers/AdminPanelController.php +++ /dev/null @@ -1,122 +0,0 @@ - $users]); - } - - public function subjects() - { - $subjects = Subject::all(); - return view('admin.admin_subjects', ['subjects' => $subjects]); - } - - public function rooms() - { - $rooms = Room::all(); - return view('admin.admin_rooms', ['rooms' => $rooms]); - } - - public function classes() - { - $classes = Classes::all(); - return view('admin.admin_classes', ['classes' => $classes]); - } - - public function attendances() - { - $attendances = Attendance::all(); - return view('admin.admin_attendances', ['attendances' => $attendances]); - } - - - - - public function delete_user($user_id) - { - User::find($user_id)->delete(); - return redirect('admin_users'); - } - - public function delete_subject($subject_id) - { - Subject::find($subject_id)->delete(); - return redirect('admin_subjects'); - } - - public function delete_room($room_id) - { - Room::find($room_id)->delete(); - return redirect('admin_rooms'); - } - - public function delete_classes($classes_id) - { - Classes::find($classes_id)->delete(); - return redirect('admin_classes'); - } - - public function delete_attendance($attendance_id) - { - Attendance::find($attendance_id)->delete(); - return redirect('admin_attendances'); - } - - - public function add_user(Request $request) - { - $name = $request->input('name'); - $surname = $request->input('surname'); - $id_number = $request->input('id_number'); - return redirect(route('admin_users')); - } - - public function add_subject(Request $request) - { - $name = $request->input('name'); - $surname = $request->input('surname'); - $id_number = $request->input('id_number'); - return redirect('admin_subjects'); - } - - public function add_room(Request $request) - { - $name = $request->input('name'); - $surname = $request->input('surname'); - $id_number = $request->input('id_number'); - return redirect('admin_rooms'); - } - - public function add_classes(Request $request) - { - $name = $request->input('name'); - $surname = $request->input('surname'); - $id_number = $request->input('id_number'); - return redirect('admin_classes'); - } - - public function add_attendance(Request $request) - { - $name = $request->input('name'); - $surname = $request->input('surname'); - $id_number = $request->input('id_number'); - return redirect('admin_attendances'); - } -} diff --git a/app/Subject.php b/app/Subject.php index 1cc95e7..5e5b8c6 100644 --- a/app/Subject.php +++ b/app/Subject.php @@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model; class Subject extends Model { protected $fillable = [ - 'name', 'type', 'room_id', 'user_id' + 'name', 'type', 'weekday', 'time', 'room_id', 'user_id' ]; } diff --git a/database/migrations/2019_11_26_232020_create_classes_table.php b/database/migrations/2019_11_26_232020_create_classes_table.php index 3465579..c8537a9 100644 --- a/database/migrations/2019_11_26_232020_create_classes_table.php +++ b/database/migrations/2019_11_26_232020_create_classes_table.php @@ -18,7 +18,7 @@ class CreateClassesTable extends Migration $table->integer('subject_id'); $table->date('date'); $table->timestamps(); - $table->foreign('subject_id')->references('id')->on('subjects'); + $table->foreign('subject_id')->references('id')->on('subjects')->onDelete('cascade'); }); } diff --git a/database/migrations/2019_11_26_232906_create_subjects_table.php b/database/migrations/2019_11_26_232906_create_subjects_table.php index 0ee52cf..9177734 100644 --- a/database/migrations/2019_11_26_232906_create_subjects_table.php +++ b/database/migrations/2019_11_26_232906_create_subjects_table.php @@ -17,11 +17,13 @@ class CreateSubjectsTable extends Migration $table->bigIncrements('id'); $table->string('name'); $table->string('type')->nullable(); + $table->string('weekday')->nullable(); + $table->string('time')->nullable(); $table->integer('room_id'); $table->integer('user_id'); $table->timestamps(); - $table->foreign('room_id')->references('id')->on('rooms'); - $table->foreign('user_id')->references('id')->on('users'); + $table->foreign('room_id')->references('id')->on('rooms')->onDelete('cascade'); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); }); } diff --git a/database/migrations/2019_11_26_232945_create_rooms_table.php b/database/migrations/2019_11_26_232945_create_rooms_table.php index 6db0bbd..2d51310 100644 --- a/database/migrations/2019_11_26_232945_create_rooms_table.php +++ b/database/migrations/2019_11_26_232945_create_rooms_table.php @@ -15,7 +15,7 @@ class CreateRoomsTable extends Migration { Schema::create('rooms', function (Blueprint $table) { $table->bigIncrements('id'); - $table->string('name'); + $table->string('name')->unique(); $table->integer('capacity')->nullable(); $table->string('arrangement')->nullable(); $table->timestamps(); diff --git a/database/migrations/2019_11_26_233012_create_attendances_table.php b/database/migrations/2019_11_26_233012_create_attendances_table.php index 4583468..a851d45 100644 --- a/database/migrations/2019_11_26_233012_create_attendances_table.php +++ b/database/migrations/2019_11_26_233012_create_attendances_table.php @@ -21,7 +21,7 @@ class CreateAttendancesTable extends Migration $table->string('student_surname'); $table->integer('seat_number'); $table->timestamps(); - $table->foreign('classes_id')->references('id')->on('classes'); + $table->foreign('classes_id')->references('id')->on('classes')->onDelete('cascade'); }); } diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 9a895dc..ae42e5a 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -18,5 +18,36 @@ class DatabaseSeeder extends Seeder 'password' => bcrypt('pass1234'), 'is_Admin' => true ]); + DB::table('users')->insert([ + 'name' => 'test', + 'surname' => 'user', + 'email' => 'test@test.com', + 'password' => bcrypt('test1234'), + 'is_Admin' => false + ]); + + $this->call([ + RoomsTableSeeder::class, + ]); + + DB::table('subjects')->insert([ + 'name' => 'Systemy Informatyczne UA0', + 'type' => 'Excercises', + 'weekday' => 'Monday', + 'time' => '17:15', + 'room_id' => 1, + 'user_id' => 2 + ]); + DB::table('classes')->insert([ + 'subject_id' => 1, + 'date' => '2019-12-02', + ]); + DB::table('attendances')->insert([ + 'classes_id' => 1, + 'student_id_number' => '416010', + 'student_name' => 'Joanna', + 'student_surname' => 'Paliwoda', + 'seat_number' => 13 + ]); } } diff --git a/database/seeds/RoomsTableSeeder.php b/database/seeds/RoomsTableSeeder.php new file mode 100644 index 0000000..a4e9e33 --- /dev/null +++ b/database/seeds/RoomsTableSeeder.php @@ -0,0 +1,73 @@ + 'A0-1', 'capacity' => 30), + array('name' => 'A0-11', 'capacity' => 24), + array('name' => 'A0-12', 'capacity' => 24), + array('name' => 'A0-3', 'capacity' => 13), + array('name' => 'A0-5', 'capacity' => 13), + array('name' => 'A1-14/15', 'capacity' => 25), + array('name' => 'A1-16/17', 'capacity' => 25), + array('name' => 'A1-18', 'capacity' => 13), + array('name' => 'A1-20', 'capacity' => 13), + array('name' => 'A1-22/23', 'capacity' => 25), + array('name' => 'A1-24/25', 'capacity' => 25), + array('name' => 'A1-33 (Sala RW)', 'capacity' => 64), + array('name' => 'A2-1', 'capacity' => 24), + array('name' => 'A2-10', 'capacity' => 34), + array('name' => 'A2-11', 'capacity' => 34), + array('name' => 'A2-12', 'capacity' => 34), + array('name' => 'A2-14', 'capacity' => 48), + array('name' => 'A2-19', 'capacity' => 48), + array('name' => 'A2-2', 'capacity' => 34), + array('name' => 'A2-20', 'capacity' => 32), + array('name' => 'A2-21', 'capacity' => 48), + array('name' => 'A2-22', 'capacity' => 48), + array('name' => 'A2-23', 'capacity' => 48), + array('name' => 'A2-24', 'capacity' => 48), + array('name' => 'A2-3', 'capacity' => 24), + array('name' => 'A2-4', 'capacity' => 24), + array('name' => 'A2-5', 'capacity' => 24), + array('name' => 'A2-8', 'capacity' => 24), + array('name' => 'A2-9', 'capacity' => 34), + array('name' => 'Aula A', 'capacity' => 196), + array('name' => 'Aula B', 'capacity' => 117), + array('name' => 'Aula C', 'capacity' => 117), + array('name' => 'B1-06', 'capacity' => 4), + array('name' => 'B1-07/08', 'capacity' => 16), + array('name' => 'B1-37', 'capacity' => 18), + array('name' => 'B1-38', 'capacity' => 12), + array('name' => 'B2-08/09', 'capacity' => 16), + array('name' => 'B2-38', 'capacity' => 15), + array('name' => 'B2-39', 'capacity' => 12), + array('name' => 'B2-44', 'capacity' => 4), + array('name' => 'B3-08/09', 'capacity' => 16), + array('name' => 'B3-38', 'capacity' => 18), + array('name' => 'B3-39', 'capacity' => 18), + array('name' => 'B3-49', 'capacity' => 12), + array('name' => 'C2-3', 'capacity' => 1), + array('name' => 'D-1', 'capacity' => 22), + array('name' => 'D-2', 'capacity' => 21), + array('name' => 'D-3', 'capacity' => 22), + array('name' => 'Klub Profesorski', 'capacity' => '') + ]; + foreach ($rooms as $room) { + DB::table('rooms')->insert([ + 'name' => $room['name'], + 'capacity' => $room['capacity'], + 'arrangement' => '' + ]); + } + } +} diff --git a/resources/views/admin/admin_attendances.blade.php b/resources/views/admin/admin_attendances.blade.php index 891de73..de36200 100644 --- a/resources/views/admin/admin_attendances.blade.php +++ b/resources/views/admin/admin_attendances.blade.php @@ -3,39 +3,135 @@ @section('title') Admin Panel - Attendance @endsection @section('admin_content') -
-
-
- @if ($attendances->count() > 0) -
All attendance: ({{ $attendances->count() }})
- +
+
+
Add new attendance record
+
+ @csrf + +
+ + +
+ + + @error('classes_id') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('student_id') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('student_name') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('student_surname') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('seat_number') + + {{ $message }} + + @enderror +
+
+ +
+
+ +
+
+ + + @if ($attendances->count() > 0) +
All attendance records: ({{ $attendances->count() }})
+
+ + + + + + + + + + + + @foreach ($attendances as $attendance) - - - - - - - + + + + + + + + + - @foreach ($attendances as $attendance) - - - - - - - - - - @endforeach -
ID Classes id Classes name Student ID Student name Student surname Seat number
ID Classes id Student ID Student name Student surname Seat number Creation date {{ $attendance->id }} {{ $attendance->classes_id }} {{ App\Subject::find(App\Classes::find($attendance->classes_id)->subject_id)->name }}, + {{ App\Subject::find(App\Classes::find($attendance->classes_id)->subject_id)->type }}, + {{ App\Classes::find($attendance->classes_id)-> date }} {{ App\Subject::find(App\Classes::find($attendance->classes_id)->subject_id)->time }} {{ $attendance->student_id_number }} {{ $attendance->student_name}} {{ $attendance->student_surname}} {{ $attendance->seat_number }} + Delete + + Edit +
{{ $attendance->id }} {{ $attendance->classes_id }} {{ $attendance->student_id_number }} {{ $attendance->student_name}} {{ $attendance->student_surname}} {{ $attendance->created_at }} - Delete -
- @else -

No attendance data yet.

- @endif -
+ @endforeach + + @else +

No attendance data yet.

+ @endif
@endsection diff --git a/resources/views/admin/admin_classes.blade.php b/resources/views/admin/admin_classes.blade.php index 9430f1e..33f690b 100644 --- a/resources/views/admin/admin_classes.blade.php +++ b/resources/views/admin/admin_classes.blade.php @@ -3,33 +3,82 @@ @section('title') Admin Panel - Classes @endsection @section('admin_content') -
-
-
- @if ($classes->count() > 0) -
All classes: ({{ $classes->count() }})
- +
+
+
Add new classes
+
+ @csrf + +
+ + +
+ + + @error('subject_id') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('date') + + {{ $message }} + + @enderror +
+
+ +
+
+ +
+
+ + @if ($classes->count() > 0) +
All classes: ({{ $classes->count() }})
+
+ + + + + + + + + @foreach ($classes as $classes_item) - - - - + + + + + + - @foreach ($classes as $classes_item) - - - - - - - @endforeach -
ID Subject id Subject name Date
ID Subject id Date Creation date {{ $classes_item->id }} {{ $classes_item->subject_id }} {{ App\Subject::find($classes_item->subject_id)->name }}, {{ App\Subject::find($classes_item->subject_id)->type }}, + {{ App\Subject::find($classes_item->subject_id)->weekday }} {{ App\Subject::find($classes_item->subject_id)->time }} {{ $classes_item->date }} + Delete + + Edit +
{{ $classes_item->id }} {{ $classes_item->subject_id }} {{ $classes_item->created_at }} - Delete -
- @else -

No classes yet.

- @endif -
+ @endforeach + + @else +

No classes yet.

+ @endif
@endsection diff --git a/resources/views/admin/admin_rooms.blade.php b/resources/views/admin/admin_rooms.blade.php index 499575d..44356db 100644 --- a/resources/views/admin/admin_rooms.blade.php +++ b/resources/views/admin/admin_rooms.blade.php @@ -3,36 +3,89 @@ @section('title') Admin Panel - Rooms @endsection @section('admin_content') -
-
-
- @if ($rooms->count() > 0) -
All rooms: ({{ $rooms->count() }})
- +
+
+
Add new room
+
+ @csrf +
+ + +
+ + + @error('name') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('capacity') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('arrangement') + + {{ $message }} + + @enderror +
+
+ +
+
+ +
+
+ + @if ($rooms->count() > 0) +
All rooms: ({{ $rooms->count() }})
+
+ + + + + + + + + @foreach ($rooms as $room) - - - - - + + + + + - @foreach ($rooms as $room) - - - - - - - - - @endforeach -
ID Name Capacity Arrangement
ID Name Capacity Arrangement Creation date {{ $room->id }} {{ $room->name }} {{ $room->capacity }} {{ $room->arrangement}} + Delete + + Edit +
{{ $room->id }} {{ $room->name }} {{ $room->capacity }} {{ $room->arrangement}} {{ $room->room_id}} - Delete -
- @else -

No rooms yet.

- @endif -
+ @endforeach + + @else +

No rooms yet.

+ @endif
@endsection diff --git a/resources/views/admin/admin_subjects.blade.php b/resources/views/admin/admin_subjects.blade.php index a14cac1..363009e 100644 --- a/resources/views/admin/admin_subjects.blade.php +++ b/resources/views/admin/admin_subjects.blade.php @@ -3,38 +3,161 @@ @section('title') Admin Panel - Subjects @endsection @section('admin_content') -
-
-
- @if ($subjects->count() > 0) -
All subjects: ({{ $subjects->count() }})
- +
+
+
Add new subject
+
+ @csrf +
+ + +
+ + + @error('name') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('type') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + + @error('weekday') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('time') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('room_id') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('user_id') + + {{ $message }} + + @enderror +
+
+ +
+
+ +
+
+ + @if ($subjects->count() > 0) +
All subjects: ({{ $subjects->count() }})
+
+ + + + + + + + + + + + + + @foreach ($subjects as $subject) - - - - - - + + + + + + + + + + + - @foreach ($subjects as $subject) - - - - - - - - - - @endforeach -
ID Name Type Day of the week Time User id User name Room id Room name
ID Name Type User id Room id Creation date {{ $subject->id }} {{ $subject->name }} {{ $subject->type }} {{ $subject->weekday }} {{ $subject->time }} {{ $subject->user_id}} {{ App\User::find($subject->user_id)->name }} {{ App\User::find($subject->user_id)->surname }} {{ $subject->room_id}} {{ App\Room::find($subject->room_id)->name }} + Delete + + Edit +
{{ $subject->id }} {{ $subject->name }} {{ $subject->type }} {{ $subject->user_id}} {{ $subject->room_id}} {{ $subject->created_at }} - Delete -
- @else -

No subjects yet.

- @endif -
+ @endforeach + + @else +

No subjects yet.

+ @endif
@endsection diff --git a/resources/views/admin/admin_users.blade.php b/resources/views/admin/admin_users.blade.php index 7502d53..d571210 100644 --- a/resources/views/admin/admin_users.blade.php +++ b/resources/views/admin/admin_users.blade.php @@ -3,42 +3,41 @@ @section('title') Admin Panel - Users @endsection @section('admin_content') -
-
-
- @if ($users->count() > 0) -
All users: ({{ $users->count() }})
- +
+
+ @if ($users->count() > 0) +
All users: ({{ $users->count() }})
+
+ + + + + + + + + + @foreach ($users as $user) - - - - - - - + + + + + + @if (!$user->is_Admin) + + + @endif - @foreach ($users as $user) - - - - - - - - - @if (!$user->is_Admin) - - @endif - - @endforeach -
ID Name Surname Email Is admin
ID Name Surname Email Email verification date Is admin Creation date {{ $user->id }} {{ $user->name }} {{ $user->surname }} {{ $user->email }} {{ $user->is_Admin }} + Delete + + Edit +
{{ $user->id }} {{ $user->name }} {{ $user->surname }} {{ $user->email }} {{ $user->email_verified_at}} {{ $user->is_Admin }} {{ $user->creatied_at}} - Delete -
- @else -

No users yet.

- @endif -
+ @endforeach + + @else +

No users yet.

+ @endif
@endsection diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index c44dd17..3364f92 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -31,7 +31,7 @@
- + @error('name') diff --git a/resources/views/layouts/adminpanel.blade.php b/resources/views/layouts/adminpanel.blade.php index ceeeea4..ba016ef 100644 --- a/resources/views/layouts/adminpanel.blade.php +++ b/resources/views/layouts/adminpanel.blade.php @@ -3,35 +3,33 @@ @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('admin_content') -
+
+
+ @if (!Auth::user()->is_Admin) +

You are not allowed to see this page.

+ Go somewhere nice + @else +
+
Admin Panel
+
+ @if (session('status')) + + @endif
- @endif -
+ +
+ @yield('admin_content') +
+
+ @endif
@endsection diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index c6cf100..d976121 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -51,7 +51,7 @@ @else @if (Auth::user()->is_Admin) @endif
diff --git a/routes/web.php b/routes/web.php index e783e81..a66b34a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -14,34 +14,35 @@ 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'); -Route::group(array('prefix' => 'admin'), function() +Route::group(array('prefix' => 'admin', 'namespace' => 'Admin'), function() { Route::get('/', 'AdminPanelController@index')->name('admin'); - Route::get('/users', 'AdminPanelController@users')->name('admin_users'); - Route::get('/subjects', 'AdminPanelController@subjects')->name('admin_subjects'); - Route::get('/rooms', 'AdminPanelController@rooms')->name('admin_rooms'); - Route::get('/classes', 'AdminPanelController@classes')->name('admin_classes'); - Route::get('/attendances', 'AdminPanelController@attendances')->name('admin_attendances'); + Route::get('/users', 'AdminUsersController@index')->name('admin_users'); + Route::get('/subjects', 'AdminSubjectsController@index')->name('admin_subjects'); + Route::get('/rooms', 'AdminRoomsController@index')->name('admin_rooms'); + Route::get('/classes', 'AdminClassesController@index')->name('admin_classes'); + Route::get('/attendances', 'AdminAttendancesController@index')->name('admin_attendances'); - Route::get('/delete_user/{user_id}', 'AdminPanelController@delete_user')->name('admin_delete_user'); - Route::get('/delete_subject/{subject_id}', 'AdminPanelController@delete_subject')->name('admin_delete_subject'); - Route::get('/delete_room/{room_id}', 'AdminPanelController@delete_room')->name('admin_delete_room'); - Route::get('/delete_classes/{classes_id}', 'AdminPanelController@delete_classes')->name('admin_delete_classes'); - Route::get('/delete_attendance/{attendance_id}', 'AdminPanelController@delete_attendance')->name('admin_delete_attendance'); + Route::post('/add_user', 'AdminUsersController@add_user')->name('admin_add_user'); + Route::post('/add_subject', 'AdminSubjectsController@add_subject')->name('admin_add_subject'); + Route::post('/add_room/', 'AdminRoomsController@add_room')->name('admin_add_room'); + Route::post('/add_classes/', 'AdminClassesController@add_classes')->name('admin_add_classes'); + Route::post('/add_attendance', 'AdminAttendancesController@add_attendance')->name('admin_add_attendance'); - Route::post('/add_user', 'AdminPanelController@add_user')->name('admin_add_user'); - Route::post('/add_subject', 'AdminPanelController@dadd_subject')->name('admin_add_subject'); - Route::post('/add_room/', 'AdminPanelController@dadd_room')->name('admin_add_room'); - Route::post('/add_classes/', 'AdminPanelController@dadd_classes')->name('admin_add_classes'); - Route::post('/add_attendance', 'AdminPanelController@add_attendance')->name('admin_add_attendance'); + Route::get('/delete_user/{user_id}', 'AdminUsersController@delete_user')->name('admin_delete_user'); + Route::get('/delete_subject/{subject_id}', 'AdminSubjectsController@delete_subject')->name('admin_delete_subject'); + Route::get('/delete_room/{room_id}', 'AdminRoomsController@delete_room')->name('admin_delete_room'); + Route::get('/delete_classes/{classes_id}', 'AdminClassesController@delete_classes')->name('admin_delete_classes'); + Route::get('/delete_attendance/{attendance_id}', 'AdminAttendancesController@delete_attendance')->name('admin_delete_attendance'); + + Route::get('/edit_user/{user_id}', 'AdminUsersController@edit_user')->name('admin_edit_user'); + Route::get('/edit_subject/{subject_id}', 'AdminSubjectsController@edit_subject')->name('admin_edit_subject'); + Route::get('/edit_room/{room_id}', 'AdminRoomsController@edit_room')->name('admin_edit_room'); + Route::get('/edit_classes/{classes_id}', 'AdminClassesController@edit_classes')->name('admin_edit_classes'); + Route::get('/edit_attendance/{attendance_id}', 'AdminAttendancesController@edit_attendance')->name('admin_edit_attendance'); });