diff --git a/app/Helpers/Qs.php b/app/Helpers/Qs.php index 3a9dbd60..9f88d7cd 100644 --- a/app/Helpers/Qs.php +++ b/app/Helpers/Qs.php @@ -78,6 +78,11 @@ public static function getTeamAdministrative() return ['admin', 'super_admin', 'accountant']; } + public static function getTeamLibrarian() + { + return ['admin', 'super_admin', 'librarian']; + } + public static function hash($id) { $date = date('dMY').'CJ'; @@ -198,6 +203,11 @@ public static function userIsPTA() return in_array(Auth::user()->user_type, self::getPTA()); } + public static function userIsLibrarian() + { + return in_array(Auth::user()->user_type, self::getTeamLibrarian()); + } + public static function userIsMyChild($student_id, $parent_id) { $data = ['user_id' => $student_id, 'my_parent_id' =>$parent_id]; diff --git a/app/Http/Controllers/SupportTeam/BookController.php b/app/Http/Controllers/SupportTeam/BookController.php index 7a08d8d1..d4118caf 100644 --- a/app/Http/Controllers/SupportTeam/BookController.php +++ b/app/Http/Controllers/SupportTeam/BookController.php @@ -1,12 +1,19 @@ \App\Http\Middleware\Custom\TeamAccount::class, 'examIsLocked' => \App\Http\Middleware\Custom\ExamIsLocked::class, 'my_parent' => \App\Http\Middleware\Custom\MyParent::class, + 'librarian'=> Librarian::class, ]; } diff --git a/app/Http/Middleware/Custom/Librarian.php b/app/Http/Middleware/Custom/Librarian.php new file mode 100644 index 00000000..0ad16281 --- /dev/null +++ b/app/Http/Middleware/Custom/Librarian.php @@ -0,0 +1,23 @@ +route('login'); + } + +} diff --git a/app/Models/Book.php b/app/Models/Book.php index c82a08c7..8a8e50a5 100644 --- a/app/Models/Book.php +++ b/app/Models/Book.php @@ -6,5 +6,15 @@ class Book extends Model { - // + protected $fillable = [ + 'name', + 'my_class_id', + 'description', + 'author', + 'book_type', + 'url', + 'location', + 'total_copies', + 'issued_copies' + ]; } diff --git a/database/seeders/UserTypesTableSeeder.php b/database/seeders/UserTypesTableSeeder.php index 16403cb8..3b6af50d 100644 --- a/database/seeders/UserTypesTableSeeder.php +++ b/database/seeders/UserTypesTableSeeder.php @@ -19,7 +19,7 @@ public function run() ['title' => 'teacher', 'name' => 'Teacher', 'level' => 3], ['title' => 'admin', 'name' => 'Admin', 'level' => 2], ['title' => 'super_admin', 'name' => 'Super Admin', 'level' => 1], - // ['title' => 'librarian', 'name' => 'librarian', 'level' => 6], + ['title' => 'librarian', 'name' => 'librarian', 'level' => 6], ]; DB::table('user_types')->insert($data); } diff --git a/database/seeders/UsersTableSeeder.php b/database/seeders/UsersTableSeeder.php index 2aa3ec3f..8e46e563 100644 --- a/database/seeders/UsersTableSeeder.php +++ b/database/seeders/UsersTableSeeder.php @@ -73,6 +73,15 @@ protected function createNewUsers() 'code' => strtoupper(Str::random(10)), 'remember_token' => Str::random(10), ], + + ['name' => 'Librarian Youness', + 'email' => 'lib@lib.com', + 'user_type' => 'librarian', + 'username' => 'librarian', + 'password' => $password, + 'code' => strtoupper(Str::random(10)), + 'remember_token' => Str::random(10), + ], ]; DB::table('users')->insert($d); } diff --git a/readme.md b/readme.md index 3915beeb..04f49b4e 100644 --- a/readme.md +++ b/readme.md @@ -55,6 +55,7 @@ After seeding. Login details as follows: | Parent | parent | parent@parent.com | cj | | Accountant | accountant | accountant@accountant.com | cj | | Student | student | student@student.com | cj | +| Librarian | librarian | lib@lib.com | cj | #### **FUNCTIONS OF ACCOUNTS** diff --git a/resources/views/pages/librarian/menu.blade.php b/resources/views/pages/librarian/menu.blade.php index fd405990..6e1eca45 100644 --- a/resources/views/pages/librarian/menu.blade.php +++ b/resources/views/pages/librarian/menu.blade.php @@ -1,4 +1,4 @@ {{--Books--}}