├── public ├── favicon.ico ├── robots.txt ├── mix-manifest.json ├── used_images │ ├── cover_nave.jpg │ └── searchbar.png ├── fonts │ └── vendor │ │ ├── font-awesome │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ │ └── @fortawesome │ │ └── fontawesome-free │ │ ├── webfa-solid-900.eot │ │ ├── webfa-solid-900.ttf │ │ ├── webfa-solid-900.woff │ │ └── webfa-solid-900.woff2 ├── .htaccess ├── js │ ├── custom_script.js │ └── admin_main.js ├── web.config ├── css │ ├── switch.css │ └── admin_custom.css ├── index.php └── svg │ └── 404.svg ├── resources ├── sass │ ├── _custom.scss │ ├── _variables.scss │ └── app.scss ├── views │ ├── inc │ │ └── message.blade.php │ ├── auth │ │ ├── verify.blade.php │ │ ├── passwords │ │ │ ├── email.blade.php │ │ │ └── reset.blade.php │ │ └── login.blade.php │ ├── authors │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── shelves │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── publishers │ │ ├── edit.blade.php │ │ ├── create.blade.php │ │ └── index.blade.php │ ├── categories │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── layouts │ │ └── tableNav.blade.php │ ├── borrowers │ │ ├── return.blade.php │ │ ├── create.blade.php │ │ ├── show.blade.php │ │ ├── index.blade.php │ │ └── edit.blade.php │ ├── receives │ │ └── index.blade.php │ ├── searched.blade.php │ ├── books │ │ ├── show.blade.php │ │ └── index.blade.php │ ├── home.blade.php │ ├── users │ │ ├── index.blade.php │ │ ├── edit.blade.php │ │ └── show.blade.php │ └── welcome.blade.php ├── lang │ └── en │ │ ├── pagination.php │ │ ├── auth.php │ │ └── passwords.php └── js │ ├── components │ └── ExampleComponent.vue │ ├── app.js │ └── bootstrap.js ├── database ├── .gitignore ├── seeds │ ├── DatabaseSeeder.php │ ├── ShelvesTableSeeder.php │ ├── CategoriesTableSeeder.php │ ├── PublishersTableSeeder.php │ ├── AuthorsTableSeeder.php │ └── UserTableSeeder.php ├── factories │ └── UserFactory.php └── migrations │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2018_11_06_193958_create_authors_table.php │ ├── 2018_11_06_194119_create_publishers_table.php │ ├── 2018_11_06_194054_create_shelves_table.php │ ├── 2018_11_06_193448_create_categories_table.php │ ├── 2018_11_23_101346_create__books__number_table.php │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2018_11_30_072046_create_receives_table.php │ ├── 2018_11_17_162120_create_borrowers_table.php │ └── 2018_11_11_192333_create_books_table.php ├── bootstrap ├── cache │ └── .gitignore └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore └── framework │ ├── cache │ └── .gitignore │ ├── testing │ └── .gitignore │ ├── views │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── .gitattributes ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php ├── Feature │ └── ExampleTest.php └── CreatesApplication.php ├── .gitignore ├── .editorconfig ├── app ├── Shelf.php ├── Category.php ├── Publisher.php ├── Author.php ├── Http │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── TrimStrings.php │ │ ├── Authenticate.php │ │ ├── TrustProxies.php │ │ ├── VerifyCsrfToken.php │ │ ├── UserTypeCheck.php │ │ ├── RedirectIfAuthenticated.php │ │ └── OnlyAdminAction.php │ ├── Controllers │ │ ├── Controller.php │ │ ├── Auth │ │ │ ├── ForgotPasswordController.php │ │ │ ├── ResetPasswordController.php │ │ │ ├── VerificationController.php │ │ │ ├── LoginController.php │ │ │ └── RegisterController.php │ │ ├── ApplicationController.php │ │ ├── HomeController.php │ │ ├── ReceivesController.php │ │ ├── AuthorsController.php │ │ ├── UsersController.php │ │ ├── PublishersController.php │ │ ├── ShelvesController.php │ │ └── CategoriesController.php │ └── Kernel.php ├── Receive.php ├── Borrower.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AppServiceProvider.php │ ├── EventServiceProvider.php │ ├── AuthServiceProvider.php │ └── RouteServiceProvider.php ├── Book.php ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php └── User.php ├── routes ├── channels.php ├── api.php ├── console.php └── web.php ├── webpack.mix.js ├── server.php ├── .env.example ├── LICENSE ├── config ├── view.php ├── services.php ├── hashing.php ├── broadcasting.php ├── filesystems.php ├── logging.php ├── queue.php ├── cache.php └── auth.php ├── package.json ├── phpunit.xml ├── composer.json ├── artisan └── readme.md /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/sass/_custom.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/app.js": "/js/app.js", 3 | "/css/app.css": "/css/app.css" 4 | } 5 | -------------------------------------------------------------------------------- /public/used_images/cover_nave.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/used_images/cover_nave.jpg -------------------------------------------------------------------------------- /public/used_images/searchbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/used_images/searchbar.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /public/fonts/vendor/font-awesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/fonts/vendor/font-awesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /public/fonts/vendor/font-awesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/fonts/vendor/font-awesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /public/fonts/vendor/font-awesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/fonts/vendor/font-awesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /public/fonts/vendor/font-awesome/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/fonts/vendor/font-awesome/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /public/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.eot -------------------------------------------------------------------------------- /public/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.ttf -------------------------------------------------------------------------------- /public/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff -------------------------------------------------------------------------------- /public/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jadoiconic/Library-management-system/HEAD/public/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff2 -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\User'); 11 | } 12 | public function books(){ 13 | return $this->hasMany('App\Book'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/Category.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\User'); 11 | } 12 | public function books(){ 13 | return $this->hasMany('App\Book'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/Publisher.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\User'); 11 | } 12 | public function books(){ 13 | return $this->hasMany('App\Book'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/Author.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Book'); 11 | } 12 | 13 | public function user(){ 14 | return $this->belongsTo('App\User'); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /resources/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | 2 | // Body 3 | $body-bg: #f8fafc; 4 | 5 | // Typography 6 | $font-family-sans-serif: "Nunito", sans-serif; 7 | $font-size-base: 0.9rem; 8 | $line-height-base: 1.6; 9 | 10 | // Colors 11 | $blue: #3490dc; 12 | $indigo: #6574cd; 13 | $purple: #9561e2; 14 | $pink: #f66D9b; 15 | $red: #e3342f; 16 | $orange: #f6993f; 17 | $yellow: #ffed4a; 18 | $green: #38c172; 19 | $teal: #4dc0b5; 20 | $cyan: #6cb2eb; 21 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Receive.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Book', 'book_id'); 11 | } 12 | public function users(){ 13 | return $this->belongsTo('App\User', 'user_id'); 14 | } 15 | public function borrowers(){ 16 | return $this->belongsTo('App\User', 'borrower_id'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/Borrower.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Book', 'book_id'); 11 | } 12 | public function users(){ 13 | return $this->belongsTo('App\User', 'user_id'); 14 | } 15 | public function librarians(){ 16 | return $this->belongsTo('App\User', 'librarian_id'); 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | 0) 2 | @foreach ($errors->all() as $item) 3 |
4 |

{{ $item }}

5 |
6 | @endforeach 7 | @endif 8 | 9 | @if (session('success')) 10 |
{{ session('success') }}
11 | @endif 12 | 13 | @if (session('error')) 14 |
{{ session('error') }}
15 | @endif 16 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 17 | return $request->user(); 18 | }); 19 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UserTableSeeder::class); 16 | $this->call(ShelvesTableSeeder::class); 17 | $this->call(AuthorsTableSeeder::class); 18 | $this->call(CategoriesTableSeeder::class); 19 | $this->call(PublishersTableSeeder::class); 20 | $this->call(BooksTableSeeder::class); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 18 | })->describe('Display an inspiring quote'); 19 | -------------------------------------------------------------------------------- /app/Http/Middleware/UserTypeCheck.php: -------------------------------------------------------------------------------- 1 | user_type < 1) { 22 | return redirect('accounts')->withErrors('Access Not Authorize...'); 23 | } 24 | return $next($request); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/home'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Handle Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /resources/js/components/ExampleComponent.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /app/Http/Middleware/OnlyAdminAction.php: -------------------------------------------------------------------------------- 1 | user_type != 2) { 22 | return redirect()->back()->with('error','You are not Authorize to perform this Action')->withInput(); 23 | } 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /public/js/custom_script.js: -------------------------------------------------------------------------------- 1 | function filterTable() { 2 | var input, filter, table, tr, td, i; 3 | input = document.getElementById("mySearchBar"); 4 | filter = input.value.toUpperCase(); 5 | table = document.getElementById("myTable"); 6 | tr = table.getElementsByTagName("tr"); 7 | for (i = 0; i < tr.length; i++) { 8 | td = tr[i].getElementsByTagName("td")[0]; 9 | if (td) { 10 | if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { 11 | tr[i].style.display = ""; 12 | } else { 13 | tr[i].style.display = "none"; 14 | } 15 | } 16 | } 17 | } 18 | $(document).ready(function () { 19 | $('#myTable').DataTable(); 20 | }); 21 | 22 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /public/js/admin_main.js: -------------------------------------------------------------------------------- 1 | let sidebar = "close"; 2 | 3 | let toggleSidebar = function () { 4 | let getMainCont = document.querySelector('.main-cont'); 5 | let getSideBar = document.querySelector('.side-bar'); 6 | let getSideMenu = document.querySelector('.side-menu'); 7 | 8 | 9 | if (sidebar === "close"){ 10 | getMainCont.style.marginLeft = "50px"; 11 | getSideBar.style.width = "150px"; 12 | getSideMenu.style.opacity = "1"; 13 | 14 | sidebar = "open" 15 | }else if (sidebar === "open"){ 16 | getMainCont.style.marginLeft = "50px"; 17 | getSideBar.style.width = "50px"; 18 | getSideMenu.style.opacity = "0"; 19 | 20 | sidebar = "close"; 21 | } 22 | }; -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * First we will load all of this project's JavaScript dependencies which 4 | * includes Vue and other libraries. It is a great starting point when 5 | * building robust, powerful web applications using Vue and Laravel. 6 | */ 7 | 8 | require('./bootstrap'); 9 | 10 | window.Vue = require('vue'); 11 | 12 | /** 13 | * Next, we will create a fresh Vue application instance and attach it to 14 | * the page. Then, you may begin adding components to this application 15 | * or customize the JavaScript scaffolding to fit your unique needs. 16 | */ 17 | 18 | Vue.component('example-component', require('./components/ExampleComponent.vue')); 19 | 20 | const app = new Vue({ 21 | // el: '#app' 22 | }); 23 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->environment('production')) { 20 | \URL::forceScheme('https'); 21 | } 22 | 23 | } 24 | 25 | /** 26 | * Register any application services. 27 | * 28 | * @return void 29 | */ 30 | public function register() 31 | { 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | 9 | DB_CONNECTION=mysql 10 | DB_HOST=127.0.0.1 11 | DB_PORT=3306 12 | DB_DATABASE=homestead 13 | DB_USERNAME=homestead 14 | DB_PASSWORD=secret 15 | 16 | BROADCAST_DRIVER=log 17 | CACHE_DRIVER=file 18 | QUEUE_CONNECTION=sync 19 | SESSION_DRIVER=file 20 | SESSION_LIFETIME=120 21 | 22 | REDIS_HOST=127.0.0.1 23 | REDIS_PASSWORD=null 24 | REDIS_PORT=6379 25 | 26 | MAIL_DRIVER=smtp 27 | MAIL_HOST=smtp.mailtrap.io 28 | MAIL_PORT=2525 29 | MAIL_USERNAME=null 30 | MAIL_PASSWORD=null 31 | MAIL_ENCRYPTION=null 32 | 33 | PUSHER_APP_ID= 34 | PUSHER_APP_KEY= 35 | PUSHER_APP_SECRET= 36 | PUSHER_APP_CLUSTER=mt1 37 | 38 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 39 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 40 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(App\User::class, function (Faker $faker) { 17 | return [ 18 | 'name' => $faker->name, 19 | 'email' => $faker->unique()->safeEmail, 20 | 'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret 21 | 'remember_token' => str_random(10), 22 | ]; 23 | }); 24 | -------------------------------------------------------------------------------- /app/Book.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\User'); 11 | } 12 | public function authors(){ 13 | return $this->belongsTo('App\Author', 'author_id'); 14 | } 15 | public function categories(){ 16 | return $this->belongsTo('App\Category', 'category_id'); 17 | } 18 | public function publishers(){ 19 | return $this->belongsTo('App\Publisher', 'publisher_id'); 20 | } 21 | public function shelves(){ 22 | return $this->belongsTo('App\Shelf', 'shelf_id'); 23 | } 24 | public function borrowers(){ 25 | return $this->hasMany('App\Borrower'); 26 | } 27 | public function issuers(){ 28 | return $this->hasMany('App\Issuer'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /public/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | 31 | /** 32 | * Register the commands for the application. 33 | * 34 | * @return void 35 | */ 36 | protected function commands() 37 | { 38 | $this->load(__DIR__.'/Commands'); 39 | 40 | require base_path('routes/console.php'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /resources/views/auth/verify.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Verify Your Email Address') }}
9 | 10 |
11 | @if (session('resent')) 12 | 15 | @endif 16 | 17 | {{ __('Before proceeding, please check your email for a verification link.') }} 18 | {{ __('If you did not receive the email') }}, {{ __('click here to request another') }}. 19 |
20 |
21 |
22 |
23 |
24 | @endsection 25 | -------------------------------------------------------------------------------- /database/migrations/2018_11_06_193958_create_authors_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name')->unique(); 19 | $table->integer('user_id')->unsigned(); 20 | $table->timestamps(); 21 | 22 | $table->foreign('user_id')->references('id') 23 | ->on('users') 24 | ->onUpdate('cascade') 25 | ->onDelete('cascade'); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('authors'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /database/migrations/2018_11_06_194119_create_publishers_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name')->unique(); 19 | $table->integer('user_id')->unsigned(); 20 | $table->timestamps(); 21 | 22 | $table->foreign('user_id')->references('id') 23 | ->on('users') 24 | ->onUpdate('cascade') 25 | ->onDelete('cascade'); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('publishers'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /database/migrations/2018_11_06_194054_create_shelves_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name')->unique(); 19 | $table->integer('status'); 20 | $table->integer('user_id')->unsigned(); 21 | $table->timestamps(); 22 | 23 | $table->foreign('user_id')->references('id') 24 | ->on('users') 25 | ->onUpdate('cascade') 26 | ->onDelete('cascade'); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::dropIfExists('shelves'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/migrations/2018_11_06_193448_create_categories_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name')->unique(); 19 | $table->integer('status'); 20 | $table->integer('user_id')->unsigned(); 21 | $table->timestamps(); 22 | 23 | $table->foreign('user_id')->references('id') 24 | ->on('users') 25 | ->onUpdate('cascade') 26 | ->onDelete('cascade'); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::dropIfExists('categories'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/seeds/ShelvesTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 16 | 'name' => 'Section 1', 17 | 'status' => 1, 18 | 'user_id' => 2, 19 | 'created_at' => '2018-11-30 09:24:34', 20 | 'updated_at' => now(), 21 | ]); 22 | DB::table('shelves')->insert([ 23 | 'name' => 'Section 2', 24 | 'status' => 1, 25 | 'user_id' => 5, 26 | 'created_at' => '2018-11-30 09:24:34', 27 | 'updated_at' => now(), 28 | ]); 29 | DB::table('shelves')->insert([ 30 | 'name' => 'Classical Section', 31 | 'status' => 1, 32 | 'user_id' => 1, 33 | 'created_at' => '2020-2-23 09:24:34', 34 | 'updated_at' => '2020-2-23 09:24:34', 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Evan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'ses' => [ 23 | 'key' => env('SES_KEY'), 24 | 'secret' => env('SES_SECRET'), 25 | 'region' => env('SES_REGION', 'us-east-1'), 26 | ], 27 | 28 | 'sparkpost' => [ 29 | 'secret' => env('SPARKPOST_SECRET'), 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => App\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /database/migrations/2018_11_23_101346_create__books__number_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->integer('book_id')->unsigned(); 19 | $table->integer('books_total_count'); 20 | $table->integer('books_available'); 21 | $table->timestamps(); 22 | 23 | $table->foreign('book_id')->references('id') 24 | ->on('books') 25 | ->onDelete('cascade') 26 | ->onUpdate('cascade'); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::table('Books_Number', function (Blueprint $table) { 38 | // 39 | }); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('first_name'); 19 | $table->string('last_name'); 20 | $table->string('username')->unique(); 21 | $table->string('email')->unique(); 22 | $table->integer('status')->default(1); 23 | $table->integer('user_type')->default(0); 24 | $table->timestamp('email_verified_at')->nullable(); 25 | $table->string('password'); 26 | $table->rememberToken(); 27 | $table->timestamps(); 28 | }); 29 | } 30 | 31 | /** 32 | * Reverse the migrations. 33 | * 34 | * @return void 35 | */ 36 | public function down() 37 | { 38 | Schema::dropIfExists('users'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "npm run development -- --watch", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "devDependencies": { 13 | "axios": "^0.21", 14 | "bootstrap": "^4.3.1", 15 | "cross-env": "^5.1", 16 | "jquery": "^3.5", 17 | "laravel-mix": "^2.0", 18 | "lodash": "^4.17.21", 19 | "popper.js": "^1.16.1", 20 | "vue": "^2.5.7" 21 | }, 22 | "dependencies": { 23 | "@fortawesome/fontawesome-free": "^5.12.1", 24 | "font-awesome": "^4.7.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Controllers/ApplicationController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 17 | $this->middleware('not_standard'); 18 | $this->middleware('only_admin'); 19 | } 20 | 21 | public function index() 22 | { 23 | $users = User::all()->where('status', 1); 24 | $books_count = DB::table('books_number')->sum('books_total_count'); 25 | $borrowers = Borrower::where('status', 1)->get(); 26 | $shelves = Shelf::all(); 27 | 28 | if (Auth::user()->user_type == 2) { 29 | $books = Book::all(); 30 | } else { 31 | $books = Book::all()->where('user_id', Auth::user()->id); 32 | } 33 | return view('application') 34 | ->with('users', $users) 35 | ->with('books', $books) 36 | ->with('books_count', $books_count) 37 | ->with('shelves', $shelves) 38 | ->with('borrowers', $borrowers); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /public/css/switch.css: -------------------------------------------------------------------------------- 1 | .switch { 2 | position: relative; 3 | display: inline-block; 4 | width: 50px; 5 | height: 22px; 6 | } 7 | 8 | .switch input { 9 | opacity: 0; 10 | width: 0; 11 | height: 0; 12 | } 13 | 14 | .slider { 15 | position: absolute; 16 | cursor: pointer; 17 | top: 0; 18 | left: 0; 19 | right: 0; 20 | bottom: 0; 21 | background-color: #ccc; 22 | -webkit-transition: .4s; 23 | transition: .4s; 24 | } 25 | 26 | .slider:before { 27 | position: absolute; 28 | content: ""; 29 | height: 15px; 30 | width: 16px; 31 | left: 4px; 32 | bottom: 4px; 33 | background-color: white; 34 | -webkit-transition: .4s; 35 | transition: .4s; 36 | } 37 | 38 | input:checked + .slider { 39 | background-color: #8b004d; 40 | } 41 | 42 | input:focus + .slider { 43 | box-shadow: 0 0 1px #2196F3; 44 | } 45 | 46 | input:checked + .slider:before { 47 | -webkit-transform: translateX(26px); 48 | -ms-transform: translateX(26px); 49 | transform: translateX(26px); 50 | } 51 | 52 | /* Rounded sliders */ 53 | .slider.round { 54 | border-radius: 32px; 55 | } 56 | 57 | .slider.round:before { 58 | border-radius: 20%; 59 | } 60 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/Unit 14 | 15 | 16 | 17 | ./tests/Feature 18 | 19 | 20 | 21 | 22 | ./app 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /resources/views/authors/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @csrf 6 |
7 |
8 |
9 |
10 |

Add New Author

11 |
12 |
13 | 14 | 15 | Author Name 16 |
17 | 18 | 19 |
20 |
21 |
22 |
23 |
24 | 25 |
26 | @endsection 27 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 |
6 |
7 | @csrf 8 |
9 |
10 |

Add New Shelf

11 |
12 |
13 | 14 | 15 | Shelf Name 16 |
17 | 18 | 19 |
20 |
21 |
22 |
23 |
24 |
25 | @endsection 26 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 18 | ]; 19 | 20 | /** 21 | * Register any authentication / authorization services. 22 | * 23 | * @return void 24 | */ 25 | public function boot() 26 | { 27 | $this->registerPolicies(); 28 | 29 | /**Create a Gate that will not allow standard users to access */ 30 | Gate::define('notStandard', function($user){ 31 | return $user->user_type > 0; 32 | }); 33 | 34 | /**Create a Gate to allow only Admin */ 35 | Gate::define('isAdmin', function($user){ 36 | return $user->user_type == 2; 37 | }); 38 | Gate::define('isLibrarian', function($user){ 39 | return $user->user_type == 1; 40 | }); 41 | 42 | Gate::define('isLogin', function(){ 43 | return Auth::check(); 44 | }); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/VerificationController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 39 | $this->middleware('signed')->only('verify'); 40 | $this->middleware('throttle:6,1')->only('verify', 'resend'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /resources/views/authors/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @method("put") 6 | @csrf 7 |
8 |
9 |
10 |
11 |

{{ __("EDIT AUTHOR") }}

12 |
13 |
14 | 15 | 16 | Author Name 17 |
18 | 19 | 20 |
21 |
22 |
23 |
24 |
25 | 26 |
27 | @endsection 28 | -------------------------------------------------------------------------------- /resources/views/publishers/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @method("put") 6 | @csrf 7 |
8 |
9 |
10 |
11 |

{{ __("EDIT PUBLISHER") }}

12 |
13 |
14 | 15 | 16 | Author Name 17 |
18 | 19 | 20 |
21 |
22 |
23 |
24 |
25 | 26 |
27 | @endsection 28 | -------------------------------------------------------------------------------- /resources/views/publishers/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 |
6 |
7 | @csrf 8 |
9 |
10 |

Add New Publisher

11 |
12 |
13 | 14 | 15 | Author Name 16 |
17 | 18 | 19 |
20 |
21 |
22 |
23 |
24 |
25 | @endsection 26 | -------------------------------------------------------------------------------- /resources/views/categories/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 |
6 |
7 | @csrf 8 |
9 |
10 |

Add New Category

11 |
12 |
13 | 14 | 15 | Category Name 16 |
17 | 18 | 19 |
20 |
21 |
22 |
23 |
24 |
25 | @endsection 26 | -------------------------------------------------------------------------------- /database/seeds/CategoriesTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 16 | 'name' => 'fictional', 17 | 'status' => 1, 18 | 'user_id' => 2, 19 | 'created_at' => now(), 20 | 'updated_at' => now(), 21 | ]); 22 | DB::table('categories')->insert([ 23 | 'name' => 'fantasy', 24 | 'status' => 1, 25 | 'user_id' => 5, 26 | 'created_at' => '2018-11-30 09:24:34', 27 | 'updated_at' => now(), 28 | ]); 29 | DB::table('categories')->insert([ 30 | 'name' => 'Science', 31 | 'status' => 1, 32 | 'user_id' => 2, 33 | 'created_at' => '2018-11-20 05:24:34', 34 | 'updated_at' => now(), 35 | ]); 36 | DB::table('categories')->insert([ 37 | 'id' => 4, 38 | 'name' => 'Classic Literature', 39 | 'status' => 1, 40 | 'user_id' => 1, 41 | 'created_at' => '2020-2-27 05:24:34', 42 | 'updated_at' => '2020-2-27 05:24:34', 43 | ]); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /database/migrations/2018_11_30_072046_create_receives_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->integer('user_id')->unsigned(); 19 | $table->integer('book_id')->unsigned(); 20 | $table->integer('borrower_id')->unsigned(); 21 | $table->timestamps(); 22 | 23 | $table->foreign('user_id')->references('id') 24 | ->on('users') 25 | ->onDelete('cascade') 26 | ->onUpdate('cascade'); 27 | $table->foreign('book_id')->references('id') 28 | ->on('books') 29 | ->onDelete('cascade') 30 | ->onUpdate('cascade'); 31 | $table->foreign('borrower_id')->references('id') 32 | ->on('borrowers') 33 | ->onDelete('cascade') 34 | ->onUpdate('cascade'); 35 | }); 36 | } 37 | 38 | /** 39 | * Reverse the migrations. 40 | * 41 | * @return void 42 | */ 43 | public function down() 44 | { 45 | Schema::dropIfExists('receives'); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Book'); 33 | } 34 | public function authors(){ 35 | return $this->hasMany('App\Author'); 36 | } 37 | public function categories(){ 38 | return $this->hasMany('App\Category'); 39 | } 40 | public function publishers(){ 41 | return $this->hasMany('App\Publisher'); 42 | } 43 | public function shelves(){ 44 | return $this->hasMany('App\Shelf'); 45 | } 46 | public function borrowers(){ 47 | return $this->hasMany('App\Borrower', 'user_id'); 48 | } 49 | public function librarians(){ 50 | return $this->hasMany('App\Borrower', 'librarian_id'); 51 | } 52 | public function receives(){ 53 | return $this->hasMany('App\Receive', 'user_id'); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /resources/views/layouts/tableNav.blade.php: -------------------------------------------------------------------------------- 1 | @can('isLibrarian') 2 | 29 | @endcan 30 | -------------------------------------------------------------------------------- /database/migrations/2018_11_17_162120_create_borrowers_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->integer('user_id')->unsigned(); 19 | $table->integer('book_id')->unsigned(); 20 | $table->integer('number_of_books'); 21 | $table->date('return_date'); 22 | $table->integer('librarian_id')->unsigned(); 23 | $table->integer('status'); 24 | $table->timestamps(); 25 | 26 | $table->foreign('user_id')->references('id') 27 | ->on('users') 28 | ->onDelete('cascade') 29 | ->onUpdate('cascade'); 30 | $table->foreign('book_id')->references('id') 31 | ->on('books') 32 | ->onDelete('cascade') 33 | ->onUpdate('cascade'); 34 | $table->foreign('librarian_id')->references('id') 35 | ->on('users') 36 | ->onDelete('cascade') 37 | ->onUpdate('cascade'); 38 | 39 | }); 40 | } 41 | 42 | /** 43 | * Reverse the migrations. 44 | * 45 | * @return void 46 | */ 47 | public function down() 48 | { 49 | Schema::dropIfExists('borrowers'); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /resources/views/borrowers/return.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 |
6 |
7 | @csrf 8 |
9 |
10 |

Return Book

11 |
12 |
13 | 14 | 15 | User's Email Address 16 |
17 |
18 | 19 | 20 | Borrowed Book 21 |
22 | 23 | 26 |
27 |
28 |
29 |
30 |
31 |
32 | @endsection 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 23 | } 24 | 25 | /** 26 | * Show the application dashboard. 27 | * 28 | * @return \Illuminate\Http\Response 29 | */ 30 | public function index() 31 | { 32 | $books = Book::orderBy('id','DESC')->paginate(3); 33 | return view('home')->with('books', $books); 34 | } 35 | 36 | public function search_results(Request $request){ 37 | 38 | $validated = $request->validate(['books' => 'required|min:4',]); 39 | $searched = $request->input('books'); 40 | if(!isset($searched)) { 41 | return redirect('searched'); 42 | } 43 | $searching = TRUE; 44 | $books = Book::where('name', 'LIKE', '%'.$searched.'%') 45 | ->OrWhere('ISBN', 'LIKE', '%'.$searched.'%') 46 | ->OrWhere('key_word', 'LIKE', '%'.$searched.'%')->get(); 47 | 48 | // self.cur.execute("""SELECT id, title, topic, content, created_at, modified_at FROM noteTbl 49 | // WHERE (title LIKE '{}%' OR topic LIKE '{}%') AND created_by = ?""".format(value, value), 50 | // (user_id,)) 51 | return view('searched')->with('books', $books)->with('searching', '$searching'); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except('logout'); 40 | } 41 | 42 | 43 | //check user status if active:1 or not active:0 44 | protected function credentials(Request $request) 45 | { 46 | return ['email' => $request->{$this->username()}, 'password' => $request->password, 'status' => '1']; 47 | } 48 | public function redirectTo() 49 | { 50 | $role = Auth::user()->user_type; 51 | if ($role != 2) { 52 | return "/accounts"; 53 | } else { 54 | return "/application"; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | name('application'); 20 | /**get search result */ 21 | Route::get('/searched', 'HomeController@search_results')->name('search'); 22 | // Auth & user login 23 | Auth::routes(); 24 | Route::get('/home', 'HomeController@index')->name('home'); 25 | Route::resource('accounts', 'AccountsController'); 26 | //UserPages Controller:account 27 | Route::resource('users', 'UsersController'); 28 | //books resource controller 29 | Route::resource('books', 'BooksController'); 30 | //authors resource controller 31 | Route::resource('authors', 'AuthorsController'); 32 | //categories resource controller 33 | Route::resource('categories', 'CategoriesController'); 34 | //shelves resource controller 35 | Route::resource('shelves', 'ShelvesController'); 36 | //publishers resource controller 37 | Route::resource('publishers', 'PublishersController'); 38 | Route::resource('borrowers', 'BorrowersController'); 39 | //Issuers resource controller 40 | Route::resource('receives', 'ReceivesController'); 41 | Route::get('/return', 'BorrowersController@return')->name('return'); 42 | Route::get('/return_index','BorrowersController@return_index')->name('return_index'); 43 | 44 | 45 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "description": "The Laravel Framework.", 4 | "keywords": ["framework", "laravel"], 5 | "license": "MIT", 6 | "type": "project", 7 | "require": { 8 | "php": "^7.1.3", 9 | "fideloper/proxy": "^4.0", 10 | "laravel/framework": "6.18.*", 11 | "laravel/tinker": "^1.0" 12 | }, 13 | "require-dev": { 14 | "beyondcode/laravel-dump-server": "^1.0", 15 | "filp/whoops": "^2.0", 16 | "fzaninotto/faker": "^1.4", 17 | "mockery/mockery": "^1.0", 18 | "nunomaduro/collision": "^2.0", 19 | "phpunit/phpunit": "^7.0" 20 | }, 21 | "autoload": { 22 | "classmap": [ 23 | "database/seeds", 24 | "database/factories" 25 | ], 26 | "psr-4": { 27 | "App\\": "app/" 28 | } 29 | }, 30 | "autoload-dev": { 31 | "psr-4": { 32 | "Tests\\": "tests/" 33 | } 34 | }, 35 | "extra": { 36 | "laravel": { 37 | "dont-discover": [ 38 | ] 39 | } 40 | }, 41 | "scripts": { 42 | "post-root-package-install": [ 43 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 44 | ], 45 | "post-create-project-cmd": [ 46 | "@php artisan key:generate" 47 | ], 48 | "post-autoload-dump": [ 49 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 50 | "@php artisan package:discover" 51 | ] 52 | }, 53 | "config": { 54 | "preferred-install": "dist", 55 | "sort-packages": true, 56 | "optimize-autoloader": true 57 | }, 58 | "minimum-stability": "dev", 59 | "prefer-stable": true 60 | } 61 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 1024, 48 | 'threads' => 2, 49 | 'time' => 2, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /database/seeds/PublishersTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 16 | 'name' => 'Allen & Unwin', 17 | 'user_id' => 2, 18 | 'created_at' => now(), 19 | 'updated_at' => now(), 20 | ]); 21 | DB::table('publishers')->insert([ 22 | 'name' => 'Arthur A. Levine', 23 | 'user_id' => 5, 24 | 'created_at' => now(), 25 | 'updated_at' => now(), 26 | ]); 27 | DB::table('publishers')->insert([ 28 | 'name' => 'Bloomsbury', 29 | 'user_id' => 2, 30 | 'created_at' => now(), 31 | 'updated_at' => now(), 32 | ]); 33 | DB::table('publishers')->insert([ 34 | 'name' => 'Atria Books ', 35 | 'user_id' => 5, 36 | 'created_at' => now(), 37 | 'updated_at' => now(), 38 | ]); 39 | DB::table('publishers')->insert([ 40 | 'id' => 5, 41 | 'name' => 'CreateSpace Independent Publishing Platform', 42 | 'user_id' => 1, 43 | 'created_at' => '2020-2-27 05:24:34', 44 | 'updated_at' => '2020-2-27 05:24:34', 45 | ]); 46 | DB::table('publishers')->insert([ 47 | 'id' => 6, 48 | 'name' => 'Albatross Publishers (March 14, 2017)', 49 | 'user_id' => 1, 50 | 'created_at' => '2020-2-27 05:24:34', 51 | 'updated_at' => '2020-2-27 05:24:34', 52 | ]); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /resources/views/shelves/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @method("put") 6 | @csrf 7 |
8 |
9 |
10 |
11 |

{{ __("EDIT SHELVES") }}

12 |
13 |
14 | 15 | 16 | shelves title 17 |
18 |
19 | 20 | 24 |
25 | 26 | 27 |
28 |
29 |
30 |
31 |
32 | 33 |
34 | @endsection 35 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /resources/views/categories/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @method("put") 6 | @csrf 7 |
8 |
9 |
10 |
11 |

{{ __("EDIT CATEGORIES") }}

12 |
13 |
14 | 15 | 16 | Category title 17 |
18 |
19 | 20 | 24 |
25 | 26 | 27 |
28 |
29 |
30 |
31 |
32 | 33 |
34 | @endsection 35 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'encrypted' => true, 41 | ], 42 | ], 43 | 44 | 'redis' => [ 45 | 'driver' => 'redis', 46 | 'connection' => 'default', 47 | ], 48 | 49 | 'log' => [ 50 | 'driver' => 'log', 51 | ], 52 | 53 | 'null' => [ 54 | 'driver' => 'null', 55 | ], 56 | 57 | ], 58 | 59 | ]; 60 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 39 | 40 | $this->mapWebRoutes(); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @return void 51 | */ 52 | protected function mapWebRoutes() 53 | { 54 | Route::middleware('web') 55 | ->namespace($this->namespace) 56 | ->group(base_path('routes/web.php')); 57 | } 58 | 59 | /** 60 | * Define the "api" routes for the application. 61 | * 62 | * These routes are typically stateless. 63 | * 64 | * @return void 65 | */ 66 | protected function mapApiRoutes() 67 | { 68 | Route::prefix('api') 69 | ->middleware('api') 70 | ->namespace($this->namespace) 71 | ->group(base_path('routes/api.php')); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | 2 | window._ = require('lodash'); 3 | window.Popper = require('popper.js').default; 4 | 5 | /** 6 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support 7 | * for JavaScript based Bootstrap features such as modals and tabs. This 8 | * code may be modified to fit the specific needs of your application. 9 | */ 10 | 11 | try { 12 | window.$ = window.jQuery = require('jquery'); 13 | 14 | require('bootstrap'); 15 | } catch (e) {} 16 | 17 | /** 18 | * We'll load the axios HTTP library which allows us to easily issue requests 19 | * to our Laravel back-end. This library automatically handles sending the 20 | * CSRF token as a header based on the value of the "XSRF" token cookie. 21 | */ 22 | 23 | window.axios = require('axios'); 24 | 25 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 26 | 27 | /** 28 | * Next we will register the CSRF Token as a common header with Axios so that 29 | * all outgoing HTTP requests automatically have it attached. This is just 30 | * a simple convenience so we don't have to attach every token manually. 31 | */ 32 | 33 | let token = document.head.querySelector('meta[name="csrf-token"]'); 34 | 35 | if (token) { 36 | window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; 37 | } else { 38 | console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); 39 | } 40 | 41 | /** 42 | * Echo exposes an expressive API for subscribing to channels and listening 43 | * for events that are broadcast by Laravel. Echo and event broadcasting 44 | * allows your team to easily build robust real-time web applications. 45 | */ 46 | 47 | // import Echo from 'laravel-echo' 48 | 49 | // window.Pusher = require('pusher-js'); 50 | 51 | // window.Echo = new Echo({ 52 | // broadcaster: 'pusher', 53 | // key: process.env.MIX_PUSHER_APP_KEY, 54 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER, 55 | // encrypted: true 56 | // }); 57 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /database/seeds/AuthorsTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 16 | 'id' => 1, 17 | 'name' => 'Jeraiya', 18 | 'user_id' => 2, 19 | 'created_at' => '2018-11-15 01:23:34', 20 | 'updated_at' => now(), 21 | ]); 22 | DB::table('authors')->insert([ 23 | 'id' => 2, 24 | 'name' => 'J. K. Rowling', 25 | 'user_id' => 2, 26 | 'created_at' => '2018-11-30 09:14:34', 27 | 'updated_at' => now(), 28 | ]); 29 | DB::table('authors')->insert([ 30 | 'id' => 3, 31 | 'name' => 'George R. R. Martin', 32 | 'user_id' => 5, 33 | 'created_at' => '2018-11-25 06:21:34', 34 | 'updated_at' => now(), 35 | ]); 36 | DB::table('authors')->insert([ 37 | 'id' => 4, 38 | 'name' => 'J. R. R. Tolkien', 39 | 'user_id' => 5, 40 | 'created_at' => now(), 41 | 'updated_at' => now(), 42 | ]); 43 | DB::table('authors')->insert([ 44 | 'id' => 5, 45 | 'name' => 'Jennifer Weiner', 46 | 'user_id' => 2, 47 | 'created_at' => now(), 48 | 'updated_at' => now(), 49 | ]); 50 | DB::table('authors')->insert([ 51 | 'id' => 6, 52 | 'name' => 'William Shakespeare', 53 | 'user_id' => 1, 54 | 'created_at' => '2020-3-12 06:21:34', 55 | 'created_at' => '2020-3-12 06:21:34', 56 | ]); 57 | DB::table('authors')->insert([ 58 | 'id' => 7, 59 | 'name' => 'Virginia Woolf', 60 | 'user_id' => 1, 61 | 'created_at' => '2020-2-12 06:21:34', 62 | 'created_at' => '2020-2-12 06:21:34', 63 | ]); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Reset Password') }}
9 | 10 |
11 | @if (session('status')) 12 | 15 | @endif 16 | 17 |
18 | @csrf 19 | 20 |
21 | 22 | 23 |
24 | 25 | 26 | @if ($errors->has('email')) 27 | 28 | {{ $errors->first('email') }} 29 | 30 | @endif 31 |
32 |
33 | 34 |
35 |
36 | 39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection 48 | -------------------------------------------------------------------------------- /resources/views/borrowers/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 |
6 |
7 | @csrf 8 |
9 |
10 |

New Issue

11 |
12 |
13 | 14 | 15 | User's Email Address 16 |
17 |
18 | 19 | 20 | Borrowed Book 21 |
22 |
23 |
24 | 25 | 26 | 27 |
28 |
29 | 30 | 31 |
32 |
33 |
34 |
35 |
36 |
37 | @endsection 38 | -------------------------------------------------------------------------------- /resources/views/categories/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @include('layouts.tableNav') 6 |
7 |
8 |
9 |

Categories 10 | @can('isLibrarian', Auth::user()) 11 | you added 12 | @endcan 13 | :

14 |
15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | @foreach ($categories as $category) 30 | 31 | 32 | 33 | @if ($category->status == 1) 34 | 35 | @else 36 | 37 | @endif 38 | 39 | 40 | 41 | @endforeach 42 | 43 |
#NameStatusAdded byAction
{{ $n++ }}{{ $category->name }}AvailableNot Available{{ $category->user->username }}Edit
44 |
45 | 46 |
47 |
48 |
49 | 50 | @endsection 51 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Library MS 2 | 3 | This is Simple Library Management System. 4 | is a software used to manage all the books in a library. This helps to keep the records of whole transactions of the books available in the library 5 | a System that will manage books and users activity. 6 | 7 | ## Prerequisites 8 | 9 | ### COMPOSER 10 | 11 | - Install PHP Composer 12 | 13 | download Composer here: 14 | 15 | > https://getcomposer.org 16 | 17 | ### NPM 18 | 19 | - Install Node 20 | 21 | Download Node here: 22 | 23 | > https://nodejs.org 24 | 25 | ### XAMPP 26 | 27 | - Install XAMPP 28 | - Run XAMPP 29 | - start MYSQL in the XAMPP Controll Panel 30 | 31 | Download XAMPP here: 32 | 33 | > https://www.apachefriends.org/download.html 34 | 35 | ## Installation 36 | 37 | In the Project directory, perform the following commands 38 | 39 | RUN 40 | 41 | ``` 42 | npm install 43 | composer install 44 | ``` 45 | 46 | - create new file and name it ".env". 47 | 48 | - copy the content from ".env.example" and paste it to the newly created ".env". 49 | change the DB_DATABASE, DB_USERNAME, DB_PASSWORD to your setting. 50 | 51 | example: 52 | 53 | ``` 54 | DB_CONNECTION=mysql 55 | DB_HOST=127.0.0.1 56 | DB_PORT=3306 57 | DB_DATABASE=library_ms 58 | DB_USERNAME=root 59 | DB_PASSWORD= 60 | ``` 61 | 62 | We generate secret key and update composer running the following commands in the terminal/cmd 63 | 64 | ``` 65 | php artisan key:generate 66 | 67 | composer update 68 | ``` 69 | 70 | We will add tables to the database we created 71 | 72 | ``` 73 | php artisan migrate 74 | ``` 75 | 76 | We generate Users and Admin of the application 77 | 78 | ``` 79 | php artisan db:seed 80 | ``` 81 | 82 | ## Running the Application 83 | 84 | in the terminal/cmd: 85 | 86 | ``` 87 | php artisan serve 88 | ``` 89 | 90 | After seeding the database. with php artisan db:seed 91 | 92 | you can Login as **Admin**. 93 | 94 | email Address: 95 | 96 | ``` 97 | admin@email.com 98 | ``` 99 | 100 | password 101 | 102 | ``` 103 | password 104 | ``` 105 | 106 | You can change the password and email of the **Admin** after you login. 107 | You can chane it at "Account Info" 108 | -------------------------------------------------------------------------------- /database/migrations/2018_11_11_192333_create_books_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->integer('category_id')->unsigned(); 20 | $table->integer('author_id')->unsigned(); 21 | $table->integer('shelf_id')->unsigned(); 22 | $table->integer('publisher_id')->unsigned(); 23 | $table->string('ISBN')->unique(); 24 | $table->string('key_word'); 25 | $table->mediumText('book_description'); 26 | $table->integer('user_id')->unsigned(); 27 | $table->timestamps(); 28 | 29 | $table->foreign('category_id')->references('id') 30 | ->on('categories') 31 | ->onDelete('cascade') 32 | ->onUpdate('cascade'); 33 | $table->foreign('author_id')->references('id') 34 | ->on('authors') 35 | ->onDelete('cascade') 36 | ->onUpdate('cascade'); 37 | $table->foreign('shelf_id')->references('id') 38 | ->on('shelves') 39 | ->onDelete('cascade') 40 | ->onUpdate('cascade'); 41 | $table->foreign('publisher_id')->references('id') 42 | ->on('publishers') 43 | ->onDelete('cascade') 44 | ->onUpdate('cascade'); 45 | $table->foreign('user_id')->references('id') 46 | ->on('users') 47 | ->onDelete('cascade') 48 | ->onUpdate('cascade'); 49 | }); 50 | } 51 | 52 | /** 53 | * Reverse the migrations. 54 | * 55 | * @return void 56 | */ 57 | public function down() 58 | { 59 | Schema::disableForeignKeyConstraints(); 60 | Schema::dropIfExists('books'); 61 | Schema::enableForeignKeyConstraints(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /resources/views/authors/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @include('layouts.tableNav') 6 |
7 |
8 |
9 |

Authors 10 | @can('isLibrarian', Auth::user()) 11 | you added 12 | @endcan 13 | :

14 |
15 | {{--
16 | 17 |
--}} 18 |
19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | @foreach ($authors as $item) 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | @endforeach 41 | 42 |
#NameAdded byAdded atAction
{{ $n++ }}{{ $item->name }}{{ $item->user->username }}{{ $item->created_at }}Edit
43 |
44 |
45 |
46 |
47 | 48 | @endsection 49 | -------------------------------------------------------------------------------- /resources/views/receives/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @include('layouts.tableNav') 6 |
7 |
8 |
9 |

Receives 10 | @can('isLibrarian', Auth::user()) 11 | you added 12 | @endcan 13 | :

14 |
15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | @foreach ($receives as $item) 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | @endforeach 41 | 42 |
#Book's TitleBorrowers EmailDate Returned
{{ $n++ }}{{ str_limit($item->books->name, 25) }}{{ str_limit($item->users->email, 15) }}{{ $item->created_at }}
43 |
44 |
45 |
46 |
47 | 48 | 52 | @endsection 53 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_ACCESS_KEY_ID'), 61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 62 | 'region' => env('AWS_DEFAULT_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | 'url' => env('AWS_URL'), 65 | ], 66 | 67 | ], 68 | 69 | ]; 70 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 41 | } 42 | 43 | /** 44 | * Get a validator for an incoming registration request. 45 | * 46 | * @param array $data 47 | * @return \Illuminate\Contracts\Validation\Validator 48 | */ 49 | protected function validator(array $data) 50 | { 51 | return Validator::make($data, [ 52 | 'first_name' => 'required|string|max:255', 53 | 'last_name' => 'required|string|max:255', 54 | 'username' => 'required|string|max:255|unique:users', 55 | // status 56 | // user_type 57 | 'email' => 'required|string|email|max:255|unique:users', 58 | 'password' => 'required|string|min:6|confirmed', 59 | ]); 60 | } 61 | 62 | /** 63 | * Create a new user instance after a valid registration. 64 | * 65 | * @param array $data 66 | * @return \App\User 67 | */ 68 | protected function create(array $data) 69 | { 70 | return User::create([ 71 | 'first_name' => $data['first_name'], 72 | 'last_name' => $data['last_name'], 73 | 'username' => $data['username'], 74 | 'email' => $data['email'], 75 | 'password' => Hash::make($data['password']), 76 | ]); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/Http/Controllers/ReceivesController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 14 | $this->middleware('not_standard'); 15 | 16 | 17 | } 18 | /** 19 | * Display a listing of the resource. 20 | * 21 | * @return \Illuminate\Http\Response 22 | */ 23 | public function index() 24 | { 25 | if (Auth::user()->user_type == 2) { 26 | $receives = Receive::all(); 27 | }else{ 28 | $receives = Receive::all()->where('user_id', Auth::user()->id); 29 | } 30 | 31 | return view('receives.index')->with('receives', $receives); 32 | } 33 | 34 | /** 35 | * Show the form for creating a new resource. 36 | * 37 | * @return \Illuminate\Http\Response 38 | */ 39 | public function create() 40 | { 41 | // 42 | } 43 | 44 | /** 45 | * Store a newly created resource in storage. 46 | * 47 | * @param \Illuminate\Http\Request $request 48 | * @return \Illuminate\Http\Response 49 | */ 50 | public function store(Request $request) 51 | { 52 | // 53 | } 54 | 55 | /** 56 | * Display the specified resource. 57 | * 58 | * @param int $id 59 | * @return \Illuminate\Http\Response 60 | */ 61 | public function show($id) 62 | { 63 | // 64 | } 65 | 66 | /** 67 | * Show the form for editing the specified resource. 68 | * 69 | * @param int $id 70 | * @return \Illuminate\Http\Response 71 | */ 72 | public function edit($id) 73 | { 74 | // 75 | } 76 | 77 | /** 78 | * Update the specified resource in storage. 79 | * 80 | * @param \Illuminate\Http\Request $request 81 | * @param int $id 82 | * @return \Illuminate\Http\Response 83 | */ 84 | public function update(Request $request, $id) 85 | { 86 | // 87 | } 88 | 89 | /** 90 | * Remove the specified resource from storage. 91 | * 92 | * @param int $id 93 | * @return \Illuminate\Http\Response 94 | */ 95 | public function destroy($id) 96 | { 97 | // 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /resources/views/searched.blade.php: -------------------------------------------------------------------------------- 1 | @extends((!isset(Auth::user()->id))? 'layouts.app': ((Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app')) 2 | @section('content') 3 |
4 |
5 |
6 |
7 |
8 |
9 | @csrf 10 |
11 | 12 |
13 | 14 |
15 |
16 |
17 | Book's: Title, ISBN, key words 18 |
19 |
20 |
21 |
22 | @if (isset($searching)) 23 |
24 |
25 |
26 | @foreach ($books as $item) 27 |
28 |
29 |
30 |

{{ $item->name }}

31 |

{{ $item->ISBN }}

32 |

{{ $item->authors->name }}

33 |

{{ str_limit($item->book_description, 80) }}

34 |
35 |
36 |
37 | @endforeach 38 |
39 |
40 |
41 | @endif 42 | @if (isset($searching) && count($books) == 0) 43 |
44 |
45 |
46 |
47 |

Sorry Could'nt Find Any. . .

48 |
49 | 51 |
52 | @endif 53 |
54 | @endsection 55 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Log Channels 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the log channels for your application. Out of 26 | | the box, Laravel uses the Monolog PHP logging library. This gives 27 | | you a variety of powerful log handlers / formatters to utilize. 28 | | 29 | | Available Drivers: "single", "daily", "slack", "syslog", 30 | | "errorlog", "monolog", 31 | | "custom", "stack" 32 | | 33 | */ 34 | 35 | 'channels' => [ 36 | 'stack' => [ 37 | 'driver' => 'stack', 38 | 'channels' => ['single'], 39 | ], 40 | 41 | 'single' => [ 42 | 'driver' => 'single', 43 | 'path' => storage_path('logs/laravel.log'), 44 | 'level' => 'debug', 45 | ], 46 | 47 | 'daily' => [ 48 | 'driver' => 'daily', 49 | 'path' => storage_path('logs/laravel.log'), 50 | 'level' => 'debug', 51 | 'days' => 7, 52 | ], 53 | 54 | 'slack' => [ 55 | 'driver' => 'slack', 56 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 57 | 'username' => 'Laravel Log', 58 | 'emoji' => ':boom:', 59 | 'level' => 'critical', 60 | ], 61 | 62 | 'stderr' => [ 63 | 'driver' => 'monolog', 64 | 'handler' => StreamHandler::class, 65 | 'with' => [ 66 | 'stream' => 'php://stderr', 67 | ], 68 | ], 69 | 70 | 'syslog' => [ 71 | 'driver' => 'syslog', 72 | 'level' => 'debug', 73 | ], 74 | 75 | 'errorlog' => [ 76 | 'driver' => 'errorlog', 77 | 'level' => 'debug', 78 | ], 79 | ], 80 | 81 | ]; 82 | -------------------------------------------------------------------------------- /resources/views/publishers/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @include('layouts.tableNav') 6 |
7 |
8 |
9 |

Publishers 10 | @can('isLibrarian', Auth::user()) 11 | you added 12 | @endcan 13 | :

14 |
15 | {{--
16 | 17 |
--}} 18 |
19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | @foreach ($publishers as $item) 33 | 34 | 35 | 36 | 37 | 38 | 41 | 42 | @endforeach 43 | 44 |
#NameAdded byAdded atAction
{{ $n++ }}{{ $item->name }}{{ $item->user->username }}{{ $item->created_at }} 39 | Edit 40 |
45 |
46 |
47 |
48 |
49 | 50 | @endsection 51 | -------------------------------------------------------------------------------- /resources/views/books/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends((!isset(Auth::user()->id))? 'layouts.app': ((Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app')) 2 | @section('content') 3 |
4 | 5 |
6 | 7 |
8 |
9 |
10 |
11 |

{{ $books->name }}

12 |

{{ $books->book_description }}

13 |
Written By:
14 |
{{ $books->authors->name }}
15 |
Published By:
16 |
{{ $books->publishers->name }}
17 |
Category:
18 |
{{ $books->categories->name }}
19 |
ISBN:
20 |
{{ $books->ISBN }}
21 | @auth 22 |
23 |
Total Stock:
24 |
{{ $books_number->books_total_count }}
25 |
26 |
27 |
Available Stock:
28 |

{{ $books_number->books_available }}

29 |
30 |
31 |
Shelf located:
32 |

{{ $books->shelves->name }}

33 |
34 | @endauth 35 | @guest 36 |
37 |

More Info

38 |
39 | @endguest 40 | 41 | 42 |
43 | 46 |
47 |
48 |
49 | @endsection 50 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 32 | \App\Http\Middleware\EncryptCookies::class, 33 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 34 | \Illuminate\Session\Middleware\StartSession::class, 35 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | 'throttle:60,1', 43 | 'bindings', 44 | ], 45 | ]; 46 | 47 | /** 48 | * The application's route middleware. 49 | * 50 | * These middleware may be assigned to groups or used individually. 51 | * 52 | * @var array 53 | */ 54 | protected $routeMiddleware = [ 55 | 'auth' => \App\Http\Middleware\Authenticate::class, 56 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 57 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 58 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 59 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 60 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 61 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 62 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 63 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 64 | 'not_standard' => Middleware\UserTypeCheck::class, 65 | 'only_admin' => Middleware\OnlyAdminAction::class, 66 | ]; 67 | } 68 | -------------------------------------------------------------------------------- /resources/views/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends((!isset(Auth::user()->id))? 'layouts.app': ((Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app')) 2 | @section('content') 3 |
4 |
5 |
6 |
7 |
8 |
9 | @csrf 10 |
11 | 12 |
13 | 14 |
15 |
16 |
17 | Book's: Title, ISBN, key words 18 |
19 |
20 |
21 |
22 | 23 | @if (isset($searching) && count($books) == 0) 24 |
25 |
26 |
27 |
28 |

Sorry Could'nt Find Any. . .

29 |
30 | 32 |
33 | @endif 34 |
35 | 36 |
37 |
38 |
39 |
40 | paginate(3); ?> 41 | @foreach($books as $item) 42 |
43 |
44 |
45 |

{{ $item->name }}

46 |

{{ $item->ISBN }}

47 |

{{ $item->authors->name }}

48 |

{{ str_limit($item->book_description, 90) }}

49 |
50 |
51 |
52 | @endforeach 53 | 54 |
55 |
{{ $books->links() }}
56 |
57 |
58 |
59 | 60 | @endsection 61 | -------------------------------------------------------------------------------- /resources/views/borrowers/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 |
6 | id)) { 8 | redirect('home'); 9 | } 10 | ?> 11 |
12 | @method('put') 13 | @csrf 14 |
15 |
16 |

Return Book

17 |
18 |
19 | 20 | 21 | User's Email Address 22 |
23 |
24 | 25 | 26 | Book's Name 27 |
28 |
29 | 30 | 31 | Borrowed Book 32 |
33 |
34 |
35 | 36 | 37 | 38 |
39 |
40 | 41 | 42 |
43 |
44 |
45 |
46 |
47 |
48 | @endsection 49 | -------------------------------------------------------------------------------- /resources/views/shelves/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @include('layouts.tableNav') 6 |
7 |
8 |
9 |

Shelves 10 | @can('isLibrarian', Auth::user()) 11 | you added 12 | @endcan 13 | :

14 |
15 | {{--
16 | 17 |
--}} 18 |
19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | @foreach ($shelves as $item) 33 | 34 | 35 | 36 | @if ($item->status == 1) 37 | 38 | @else 39 | 40 | @endif 41 | 42 | 43 | 46 | 47 | @endforeach 48 | 49 |
#NameStatusAdded byAction
{{ $n++ }}{{ $item->name }}AvailableNot Available{{ $item->user->username }} 44 | Edit 45 |
50 |
51 |
52 |
53 |
54 | 55 | @endsection 56 | -------------------------------------------------------------------------------- /resources/views/books/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @include('layouts.tableNav') 6 |
7 |
8 |
9 |

Books 10 | @can('isLibrarian', Auth::user()) 11 | you added 12 | @endcan 13 | :

14 |
15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | {{-- --}} 24 | 25 | 26 | {{-- --}} 27 | 28 | 29 | 30 | 31 | 32 | @foreach ($books as $book) 33 | 34 | 35 | 36 | 37 | {{-- --}} 38 | 39 | 40 | {{-- --}} 41 | 45 | 46 | @endforeach 47 | 48 |
#NameAuthorCategorycategoryISBNAdded byAction
{{ $n++ }}{{ str_limit($book->name, 25) }}{{ str_limit($book->authors->name,11) }}{{ $book->categories->name }}{{ str_limit($book->categories->name, 11) }}{{ str_limit($book->ISBN, 11) }}{{ $book->user->email }} 42 | 43 | Edit 44 |
49 |
50 |
51 |
52 |
53 | 54 | @endsection 55 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => env('SQS_KEY', 'your-public-key'), 54 | 'secret' => env('SQS_SECRET', 'your-secret-key'), 55 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 56 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 57 | 'region' => env('SQS_REGION', 'us-east-1'), 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => 'default', 64 | 'retry_after' => 90, 65 | 'block_for' => null, 66 | ], 67 | 68 | ], 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Failed Queue Jobs 73 | |-------------------------------------------------------------------------- 74 | | 75 | | These options configure the behavior of failed queue job logging so you 76 | | can control which database and table are used to store the jobs that 77 | | have failed. You may change them to any database / table you wish. 78 | | 79 | */ 80 | 81 | 'failed' => [ 82 | 'database' => env('DB_CONNECTION', 'mysql'), 83 | 'table' => 'failed_jobs', 84 | ], 85 | 86 | ]; 87 | -------------------------------------------------------------------------------- /database/seeds/UserTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 16 | 'first_name' => 'admin_name', 17 | 'last_name' => 'admin_last', 18 | 'username' => 'admin_username', 19 | 'email' => 'admin@email.com', 20 | 'status' => 1, 21 | 'user_type' => 2, 22 | 'password' => bcrypt('password'), 23 | 'created_at' => '2018-09-13 05:21:34', 24 | 'updated_at' => now(), 25 | ]); 26 | 27 | DB::table('users')->insert([ 28 | 'first_name' => 'naruto', 29 | 'last_name' => 'uzumaki', 30 | 'username' => 'naruuzum', 31 | 'email' => 'naruto@email.net', 32 | 'status' => 1, 33 | 'user_type' => 1, 34 | 'password' => bcrypt('secret'), 35 | 'created_at' => '2018-11-21 09:24:34', 36 | 'updated_at' => now(), 37 | ]); 38 | 39 | DB::table('users')->insert([ 40 | 'first_name' => 'Saitama', 41 | 'last_name' => 'master', 42 | 'username' => 'saimaster', 43 | 'email' => 'saimaster@email.com', 44 | 'status' => 1, 45 | 'user_type' => 0, 46 | 'password' => bcrypt('secret'), 47 | 'created_at' => '2018-11-30 09:24:34', 48 | 'updated_at' => now(), 49 | ]); 50 | 51 | DB::table('users')->insert([ 52 | 'first_name' => 'Jane', 53 | 'last_name' => 'Doe', 54 | 'username' => 'janedoe', 55 | 'email' => 'janedoe@email.com', 56 | 'status' => 1, 57 | 'user_type' => 0, 58 | 'password' => bcrypt('secret'), 59 | 'created_at' => now(), 60 | 'updated_at' => now(), 61 | ]); 62 | 63 | DB::table('users')->insert([ 64 | 'first_name' => 'Traxex', 65 | 'last_name' => 'Drow', 66 | 'username' => 'Drow_Ranger', 67 | 'email' => 'fakemail@email.com', 68 | 'status' => 1, 69 | 'user_type' => 1, 70 | 'password' => bcrypt('secret'), 71 | 'created_at' => '2018-11-10 09:24:34', 72 | 'updated_at' => now(), 73 | ]); 74 | 75 | DB::table('users')->insert([ 76 | 'first_name' => 'John', 77 | 'last_name' => 'Doe', 78 | 'username' => 'johndoe', 79 | 'email' => 'johndoe@email.com', 80 | 'status' => 1, 81 | 'user_type' => 0, 82 | 'password' => bcrypt('secret'), 83 | 'created_at' => '2018-11-10 09:24:34', 84 | 'updated_at' => now(), 85 | ]); 86 | 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /resources/views/users/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @include('layouts.tableNav') 6 |
7 |
8 |
9 |

Users:

10 |
11 |
12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach ($users as $user) 27 | 28 | 29 | 30 | 31 | 41 | 48 | 52 | 53 | @endforeach 54 | 55 |
#UsernameEmailRoleStatusAction
{{ $n++ }}{{ $user->username}}{{ $user->email }} 32 | @if ($user->user_type == 0) 33 | Standard 34 | @elseif($user->user_type == 1) 35 | Librarian 36 | @elseif($user->user_type == 2) 37 | Admin 38 | @endif 39 | 40 | 42 | @if ($user->status == 1) 43 |

Active

44 | @else 45 |

Inactive

46 | @endif 47 |
49 | View 50 | Edit 51 |
56 |
57 |
58 |
59 |
60 | 61 | @endsection 62 | -------------------------------------------------------------------------------- /public/css/admin_custom.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Lato", sans-serif; 3 | } 4 | .navbar-laravel { 5 | position: fixed; 6 | } 7 | 8 | .sidenav { 9 | height: 100%; 10 | width: 230px; 11 | position: fixed; 12 | z-index: 1; 13 | top: 0; 14 | left: 0; 15 | background-color: #111; 16 | overflow-x: hidden; 17 | transition: 0.5s; 18 | padding-top: 60px; 19 | } 20 | 21 | .sidenav a { 22 | padding: 8px 8px 8px 32px; 23 | text-decoration: none; 24 | font-size: 17px; 25 | margin-left: 10px; 26 | color: #818181; 27 | display: block; 28 | margin-left: 10px; 29 | transition: 0.3s; 30 | } 31 | 32 | .sidenav_menu { 33 | display: show; 34 | } 35 | 36 | .sidenav a:hover { 37 | color: #f1f1f1; 38 | } 39 | 40 | .sidenav .closebtn { 41 | position: absolute; 42 | top: 0; 43 | right: 25px; 44 | font-size: 36px; 45 | margin-left: 50px; 46 | } 47 | 48 | #main { 49 | transition: margin-left 0.5s; 50 | padding: 16px; 51 | margin-left: 230px; 52 | } 53 | 54 | .dropdown-content { 55 | display: none; 56 | position: absolute; 57 | right: 0; 58 | background-color: #333; 59 | min-width: 160px; 60 | box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); 61 | z-index: 1; 62 | } 63 | 64 | .dropdown-content a { 65 | color: black; 66 | padding: 12px 16px; 67 | text-decoration: none; 68 | display: block; 69 | } 70 | 71 | .dropdown-content a:hover { 72 | background-color: #f1f1f1; 73 | } 74 | 75 | .dropdown:hover .dropdown-content { 76 | display: block; 77 | } 78 | 79 | .dropdown:hover .dropbtn_side { 80 | background-color: #151414; 81 | } 82 | .dropdown-item_side { 83 | color: ghostwhite; 84 | background-color: #111 !important; 85 | } 86 | .custom-red { 87 | background-color: #8b004d !important; 88 | color: #f1f1f1 !important; 89 | } 90 | .dropdown, 91 | .dropleft-side { 92 | position: relative; 93 | /* margin-top: -20px; */ 94 | } 95 | 96 | @media only screen and (max-width: 600px) { 97 | .sidenav { 98 | height: 100%; 99 | width: 100%; 100 | position: fixed; 101 | z-index: 1; 102 | top: 0; 103 | left: 0; 104 | background-color: #111; 105 | overflow-x: hidden; 106 | transition: 0.5s; 107 | padding-top: 60px; 108 | text-align: left; 109 | } 110 | 111 | .sidenav a { 112 | padding: 8px 8px 8px 32px; 113 | text-decoration: none; 114 | font-size: 24px; 115 | font-weight: 600; 116 | color: #818181; 117 | display: block; 118 | transition: 0.3s; 119 | } 120 | 121 | .sidenav a:hover { 122 | color: #f1f1f1; 123 | } 124 | 125 | .sidenav .closebtn { 126 | position: absolute; 127 | top: 0; 128 | right: 25px; 129 | font-size: 36px; 130 | margin-left: 50px; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | */ 30 | 31 | 'stores' => [ 32 | 33 | 'apc' => [ 34 | 'driver' => 'apc', 35 | ], 36 | 37 | 'array' => [ 38 | 'driver' => 'array', 39 | ], 40 | 41 | 'database' => [ 42 | 'driver' => 'database', 43 | 'table' => 'cache', 44 | 'connection' => null, 45 | ], 46 | 47 | 'file' => [ 48 | 'driver' => 'file', 49 | 'path' => storage_path('framework/cache/data'), 50 | ], 51 | 52 | 'memcached' => [ 53 | 'driver' => 'memcached', 54 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 55 | 'sasl' => [ 56 | env('MEMCACHED_USERNAME'), 57 | env('MEMCACHED_PASSWORD'), 58 | ], 59 | 'options' => [ 60 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 61 | ], 62 | 'servers' => [ 63 | [ 64 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 65 | 'port' => env('MEMCACHED_PORT', 11211), 66 | 'weight' => 100, 67 | ], 68 | ], 69 | ], 70 | 71 | 'redis' => [ 72 | 'driver' => 'redis', 73 | 'connection' => 'cache', 74 | ], 75 | 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Cache Key Prefix 81 | |-------------------------------------------------------------------------- 82 | | 83 | | When utilizing a RAM based store such as APC or Memcached, there might 84 | | be other applications utilizing the same cache. So, we'll specify a 85 | | value to get prefixed to all our keys so we can avoid collisions. 86 | | 87 | */ 88 | 89 | 'prefix' => env( 90 | 'CACHE_PREFIX', 91 | str_slug(env('APP_NAME', 'laravel'), '_').'_cache' 92 | ), 93 | 94 | ]; 95 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Laravel 9 | 10 | 11 | 12 | 13 | 14 | 66 | 67 | 68 |
69 | @if (Route::has('login')) 70 | 78 | @endif 79 | 80 |
81 |
82 | Laravel 83 |
84 | 85 | 93 |
94 |
95 | 96 | 97 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Reset Password') }}
9 | 10 |
11 |
12 | @csrf 13 | 14 | 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | @if ($errors->has('email')) 23 | 24 | {{ $errors->first('email') }} 25 | 26 | @endif 27 |
28 |
29 | 30 |
31 | 32 | 33 |
34 | 35 | 36 | @if ($errors->has('password')) 37 | 38 | {{ $errors->first('password') }} 39 | 40 | @endif 41 |
42 |
43 | 44 |
45 | 46 | 47 |
48 | 49 |
50 |
51 | 52 |
53 |
54 | 57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | @endsection 66 | -------------------------------------------------------------------------------- /app/Http/Controllers/AuthorsController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 14 | // $this->middleware('not_standard', ['except' => ['show',]]); 15 | $this->middleware('only_admin')->except('create', 'store', 'index'); 16 | 17 | } 18 | /** 19 | * Display a listing of the resource. 20 | * 21 | * @return \Illuminate\Http\Response 22 | */ 23 | public function index() 24 | { 25 | if (Auth::user()->user_type == 2) { 26 | $authors = Author::all(); 27 | }else{ 28 | $authors = Author::all()->where('user_id', Auth::user()->id); 29 | } 30 | 31 | return view('authors.index')->with('authors', $authors); 32 | } 33 | 34 | /** 35 | * Show the form for creating a new resource. 36 | * 37 | * @return \Illuminate\Http\Response 38 | */ 39 | public function create() 40 | { 41 | return view('authors.create'); 42 | } 43 | 44 | /** 45 | * Store a newly created resource in storage. 46 | * 47 | * @param \Illuminate\Http\Request $request 48 | * @return \Illuminate\Http\Response 49 | */ 50 | public function store(Request $request) 51 | { 52 | $user = Auth::user(); 53 | $validated = $request->validate([ 54 | 'name' => 'required|unique:authors', 55 | ]); 56 | 57 | $authors = New Author; 58 | $authors->name = $request->input('name'); 59 | $authors->user_id = $user->id; 60 | $authors->save(); 61 | 62 | 63 | return redirect('authors')->with('success', 'New Author ' .$authors->name. ' has been added!'); 64 | } 65 | 66 | /** 67 | * Display the specified resource. 68 | * 69 | * @param int $id 70 | * @return \Illuminate\Http\Response 71 | */ 72 | public function show($id) 73 | { 74 | $authors = Author::findOrFail($id); 75 | 76 | } 77 | 78 | /** 79 | * Show the form for editing the specified resource. 80 | * 81 | * @param int $id 82 | * @return \Illuminate\Http\Response 83 | */ 84 | public function edit($id) 85 | { 86 | $authors = Author::find($id); 87 | return view("authors.edit")->with('authors', $authors); 88 | } 89 | 90 | /** 91 | * Update the specified resource in storage. 92 | * 93 | * @param \Illuminate\Http\Request $request 94 | * @param int $id 95 | * @return \Illuminate\Http\Response 96 | */ 97 | public function update(Request $request, $id) 98 | { 99 | $validated = $request->validate([ 100 | 'name' => 'required|unique:authors', 101 | ]); 102 | $authors = Author::find($id); 103 | 104 | $authors->name = $request->input("name"); 105 | $authors->save(); 106 | 107 | return redirect("authors")->with("success", "Author ".$request->input("name"). "have been Updated."); 108 | } 109 | 110 | /** 111 | * Remove the specified resource from storage. 112 | * 113 | * @param int $id 114 | * @return \Illuminate\Http\Response 115 | */ 116 | public function destroy($id) 117 | { 118 | // 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /resources/views/borrowers/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 | @include('layouts.tableNav') 6 |
7 |
8 |
9 |

Borrowers 10 | @can('isLibrarian', Auth::user()) 11 | you added 12 | @endcan 13 | :

14 |
15 | {{--
16 | 17 |
--}} 18 |
19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | @foreach ($borrowers as $item) 35 | 36 | 37 | 38 | 39 | 40 | 47 | 54 | 55 | @endforeach 56 | 57 |
#Book's TitleBorrowers Email Date to Return StatusAction
{{ $n++ }}{{ str_limit($item->books->name, 25) }}{{ str_limit($item->users->email, 15) }}{{ $item->return_date }} 41 | @if ($item->status > 0) 42 |

Not Returned

43 | @elseif($item->status == 0) 44 |

Returned

45 | @endif 46 |
48 | @if ($item->status > 0) 49 | Return 50 | @elseif($item->status == 0) 51 | 52 | @endif 53 |
58 |
59 |
60 |
61 |
62 | 63 | 67 | @endsection 68 | -------------------------------------------------------------------------------- /app/Http/Controllers/UsersController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 16 | $this->middleware('not_standard'); 17 | $this->middleware('only_admin'); 18 | } 19 | /** 20 | * Display a listing of the resource. 21 | * 22 | * @return \Illuminate\Http\Response 23 | */ 24 | public function index() 25 | { 26 | $me = Auth::user(); 27 | $users = User::all()->where('id', '!=', $me->id); 28 | return view("users.index")->with('users', $users); 29 | } 30 | 31 | /** 32 | * Show the form for creating a new resource. 33 | * 34 | * @return \Illuminate\Http\Response 35 | */ 36 | public function create() 37 | { 38 | //located at Register Controller 39 | } 40 | 41 | /** 42 | * Store a newly created resource in storage. 43 | * 44 | * @param \Illuminate\Http\Request $request 45 | * @return \Illuminate\Http\Response 46 | */ 47 | public function store(Request $request) 48 | { 49 | // 50 | } 51 | 52 | /** 53 | * Display the specified resource. 54 | * 55 | * @param int $id 56 | * @return \Illuminate\Http\Response 57 | */ 58 | public function show($id) 59 | { 60 | $users = User::findOrFail($id); 61 | $current_borrowed = Borrower::all()->where('status', '=', 1)->where('user_id', '=', $id); 62 | $total_borrowed = Borrower::all()->where('user_id', '=', $id); 63 | return view("users.show") 64 | ->with('users', $users) 65 | ->with('borrowed', $current_borrowed) 66 | ->with('total_borrowed', $total_borrowed); 67 | 68 | } 69 | 70 | /** 71 | * Show the form for editing the specified resource. 72 | * 73 | * @param int $id 74 | * @return \Illuminate\Http\Response 75 | */ 76 | public function edit($id) 77 | { 78 | $users = User::findOrFail($id); 79 | return view("users.edit")->with('users', $users); 80 | } 81 | 82 | /** 83 | * Update the specified resource in storage. 84 | * 85 | * @param \Illuminate\Http\Request $request 86 | * @param int $id 87 | * @return \Illuminate\Http\Response 88 | */ 89 | public function update(Request $request, $id) 90 | { 91 | $users = User::find($id); 92 | $users->first_name = $request->input("first_name"); 93 | $users->last_name = $request->input("last_name"); 94 | $users->username = $request->input("username"); 95 | $users->email = $request->input("email"); 96 | $users->status = $request->input('user_status'); 97 | $users->user_type = $request->input('user_type'); 98 | $users->save(); 99 | 100 | return redirect('/users')->with('success', "User ".$users->username. " have been Updated!!!"); 101 | } 102 | 103 | /** 104 | * Remove the specified resource from storage. 105 | * 106 | * @param int $id 107 | * @return \Illuminate\Http\Response 108 | */ 109 | public function destroy($id) 110 | { 111 | // 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __("Don't be shy :)") }}
9 | 10 |
11 |
12 | @csrf 13 | 14 |
15 | 16 | 17 |
18 | 19 | 20 | @if ($errors->has('email')) 21 | 22 | {{ $errors->first('email') }} 23 | 24 | @endif 25 |
26 |
27 | 28 |
29 | 30 | 31 |
32 | 33 | 34 | @if ($errors->has('password')) 35 | 36 | {{ $errors->first('password') }} 37 | 38 | @endif 39 |
40 |
41 | 42 |
43 |
44 |
45 | 46 | 47 | 50 |
51 |
52 |
53 | 54 |
55 |
56 | 59 | 60 | 61 | {{ __('Forgot Your Password?') }} 62 | 63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | @endsection 72 | -------------------------------------------------------------------------------- /resources/views/users/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 |
6 |
7 |
8 |
9 | User's Info 10 |
11 | 12 |
13 |
14 |
First name:
15 | 16 |
17 |
18 |
Last name:
19 | 20 |
21 |
22 |
23 |
24 |
25 |
Usersname:
26 | 27 |
28 |
29 |
Email:
30 | 31 |
32 | 33 |
34 |
35 |
Created at:
36 |
{{ $users->created_at }}
37 |
38 |
39 | 40 |
41 | @method('put') 42 | @csrf 43 |
44 |
Status:
45 | 46 | status == 1) ? "checked" : "" }}>
47 | 48 | 49 | status == 0) ? "checked" : "" }}>
50 |
51 |
52 |
Role:
53 | 54 | user_type == 0) ? "checked" : "" }}>
55 | 56 | 57 | user_type == 1) ? "checked" : "" }}>
58 | 59 | 60 | user_type == 2) ? "checked" : "" }}> 61 |
62 |
63 |
64 | 65 | 66 |
67 |
68 |
69 |
70 |
71 | @endsection 72 | -------------------------------------------------------------------------------- /app/Http/Controllers/PublishersController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 18 | $this->middleware('not_standard'); 19 | $this->middleware('only_admin')->except('create', 'store', 'index'); 20 | } 21 | /** 22 | * Display a listing of the resource. 23 | * 24 | * @return \Illuminate\Http\Response 25 | */ 26 | public function index() 27 | { 28 | if (Auth::user()->user_type == 2) { 29 | $publishers = Publisher::all(); 30 | }else{ 31 | $publishers = Publisher::all()->where('user_id', Auth::user()->id); 32 | } 33 | 34 | return view('publishers.index')->with('publishers', $publishers); 35 | } 36 | 37 | /** 38 | * Show the form for creating a new resource. 39 | * 40 | * @return \Illuminate\Http\Response 41 | */ 42 | public function create() 43 | { 44 | return view('publishers.create'); 45 | } 46 | 47 | /** 48 | * Store a newly created resource in storage. 49 | * 50 | * @param \Illuminate\Http\Request $request 51 | * @return \Illuminate\Http\Response 52 | */ 53 | public function store(Request $request) 54 | { 55 | $user = Auth::user(); 56 | $validated = $request->validate([ 57 | 'name' => 'required|unique:publishers', 58 | ]); 59 | 60 | $publishers = New Publisher(); 61 | $publishers->name = $request->input('name'); 62 | $publishers->user_id = $user->id; 63 | $publishers->save(); 64 | 65 | return redirect('publishers')->with('success','New Publisher '.$publishers->name.' has been added!'); 66 | } 67 | 68 | /** 69 | * Display the specified resource. 70 | * 71 | * @param int $id 72 | * @return \Illuminate\Http\Response 73 | */ 74 | public function show($id) 75 | { 76 | // 77 | } 78 | 79 | /** 80 | * Show the form for editing the specified resource. 81 | * 82 | * @param int $id 83 | * @return \Illuminate\Http\Response 84 | */ 85 | public function edit($id) 86 | { 87 | $publishers = Publisher::find($id); 88 | return view("publishers.edit")->with('publishers', $publishers); 89 | } 90 | 91 | /** 92 | * Update the specified resource in storage. 93 | * 94 | * @param \Illuminate\Http\Request $request 95 | * @param int $id 96 | * @return \Illuminate\Http\Response 97 | */ 98 | public function update(Request $request, $id) 99 | { 100 | $user = Auth::user(); 101 | $validated = $request->validate([ 102 | 'name' => 'required|unique:publishers', 103 | ]); 104 | 105 | $publishers = Publisher::find($id); 106 | $publishers->name = $request->input('name'); 107 | $publishers->save(); 108 | 109 | return redirect('publishers')->with('success','Publisher '.$publishers->name.' have been Updated!'); 110 | } 111 | 112 | /** 113 | * Remove the specified resource from storage. 114 | * 115 | * @param int $id 116 | * @return \Illuminate\Http\Response 117 | */ 118 | public function destroy($id) 119 | { 120 | // 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'token', 46 | 'provider' => 'users', 47 | ], 48 | ], 49 | 50 | /* 51 | |-------------------------------------------------------------------------- 52 | | User Providers 53 | |-------------------------------------------------------------------------- 54 | | 55 | | All authentication drivers have a user provider. This defines how the 56 | | users are actually retrieved out of your database or other storage 57 | | mechanisms used by this application to persist your user's data. 58 | | 59 | | If you have multiple user tables or models you may configure multiple 60 | | sources which represent each model / table. These sources may then 61 | | be assigned to any extra authentication guards you have defined. 62 | | 63 | | Supported: "database", "eloquent" 64 | | 65 | */ 66 | 67 | 'providers' => [ 68 | 'users' => [ 69 | 'driver' => 'eloquent', 70 | 'model' => App\User::class, 71 | ], 72 | 73 | // 'users' => [ 74 | // 'driver' => 'database', 75 | // 'table' => 'users', 76 | // ], 77 | ], 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Resetting Passwords 82 | |-------------------------------------------------------------------------- 83 | | 84 | | You may specify multiple password reset configurations if you have more 85 | | than one user table or model in the application and you want to have 86 | | separate password reset settings based on the specific user types. 87 | | 88 | | The expire time is the number of minutes that the reset token should be 89 | | considered valid. This security feature keeps tokens short-lived so 90 | | they have less time to be guessed. You may change this as needed. 91 | | 92 | */ 93 | 94 | 'passwords' => [ 95 | 'users' => [ 96 | 'provider' => 'users', 97 | 'table' => 'password_resets', 98 | 'expire' => 60, 99 | ], 100 | ], 101 | 102 | ]; 103 | -------------------------------------------------------------------------------- /app/Http/Controllers/ShelvesController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 18 | $this->middleware('not_standard'); 19 | $this->middleware('only_admin')->except('create', 'store', 'index'); 20 | } 21 | /** 22 | * Display a listing of the resource. 23 | * 24 | * @return \Illuminate\Http\Response 25 | */ 26 | public function index() 27 | { 28 | if (Auth::user()->user_type == 2) { 29 | $shelves = Shelf::all(); 30 | }else{ 31 | $shelves = Shelf::all()->where('user_id', Auth::user()->id); 32 | } 33 | 34 | return view('shelves.index')->with('shelves', $shelves); 35 | } 36 | 37 | /** 38 | * Show the form for creating a new resource. 39 | * 40 | * @return \Illuminate\Http\Response 41 | */ 42 | public function create() 43 | { 44 | return view('shelves.create'); 45 | } 46 | 47 | /** 48 | * Store a newly created resource in storage. 49 | * 50 | * @param \Illuminate\Http\Request $request 51 | * @return \Illuminate\Http\Response 52 | */ 53 | public function store(Request $request) 54 | { 55 | $user = Auth::user(); 56 | $validated = $request->validate([ 57 | 'name' => 'required|unique:shelves', 58 | ]); 59 | 60 | $shelves = New Shelf(); 61 | $shelves->name = $request->input('name'); 62 | $shelves->user_id = $user->id; 63 | $shelves->status = 1; 64 | $shelves->save(); 65 | 66 | return redirect('shelves')->with('success','New Shelf '.$shelves->name.' has been added!'); 67 | } 68 | 69 | /** 70 | * Display the specified resource. 71 | * 72 | * @param int $id 73 | * @return \Illuminate\Http\Response 74 | */ 75 | public function show($id) 76 | { 77 | // 78 | } 79 | 80 | /** 81 | * Show the form for editing the specified resource. 82 | * 83 | * @param int $id 84 | * @return \Illuminate\Http\Response 85 | */ 86 | public function edit($id) 87 | { 88 | $shelves = Shelf::find($id); 89 | return view("shelves.edit")->with('shelves', $shelves); 90 | } 91 | 92 | /** 93 | * Update the specified resource in storage. 94 | * 95 | * @param \Illuminate\Http\Request $request 96 | * @param int $id 97 | * @return \Illuminate\Http\Response 98 | */ 99 | public function update(Request $request, $id) 100 | { 101 | 102 | $validated = $request->validate([ 103 | 'name' => 'required', 104 | ]); 105 | 106 | $status_input = $request->input('status'); 107 | if (!isset($status_input)) { 108 | $status = 0; 109 | }else{ 110 | $status = 1; 111 | } 112 | $shelves = Shelf::find($id); 113 | $shelves->name = $request->input("name"); 114 | $shelves->status = $status; 115 | $shelves->save(); 116 | return redirect("shelves")->with("success", "Shelves ".$request->input('name'). "have been Updated!"); 117 | } 118 | 119 | /** 120 | * Remove the specified resource from storage. 121 | * 122 | * @param int $id 123 | * @return \Illuminate\Http\Response 124 | */ 125 | public function destroy($id) 126 | { 127 | // 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /resources/views/users/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 |
6 |
7 |
8 | User's Info 9 |
10 | 11 |
12 |
13 |

name:

14 |
15 |
16 |

{{ $users->first_name.' '.$users->last_name }}

17 |
18 |
19 |
20 |
21 |

email:

22 |
23 |
24 |

{{ $users->email }}

25 |
26 |
27 |
28 |
29 |

username:

30 |
31 |
32 |

{{ $users->username }}

33 |
34 |
35 |
36 |
37 |

user type:

38 |
39 |
40 |

41 | @if ($users->user_type == 0) 42 | standard 43 | @elseif($users->user_type == 1) 44 | librarian 45 | @elseif($users->user_type == 2) 46 | admin 47 | @endif 48 |

49 |
50 |
51 |
52 |
53 |

current borrowed books:

54 |
55 |
56 |

{{ count($borrowed) }}

57 |
58 |
59 |
60 |
61 |

total borrowed books:

62 |
63 |
64 |

{{ count($total_borrowed) }}

65 |
66 |
67 |
68 | 69 |
70 |
71 |
72 |
73 | @endsection 74 | -------------------------------------------------------------------------------- /app/Http/Controllers/CategoriesController.php: -------------------------------------------------------------------------------- 1 | middleware(function ($request, $next) { 18 | $this->user= Auth::user(); 19 | 20 | return $next($request); 21 | }); 22 | 23 | /** 24 | * redirect unauthenticated users 25 | */ 26 | $this->middleware('auth'); 27 | // $this->middleware('not_standard', ['except' => ['show']]); 28 | $this->middleware('only_admin')->except('create', 'store', 'index'); 29 | 30 | } 31 | /** 32 | * Display a listing of the resource. 33 | * 34 | * @return \Illuminate\Http\Response 35 | */ 36 | public function index() 37 | { 38 | if (Auth::user()->user_type == 2) { 39 | $categories = Category::all(); 40 | }else{ 41 | $categories = Category::all()->where('user_id', Auth::user()->id); 42 | } 43 | 44 | return view('categories.index')->with('categories', $categories); 45 | } 46 | 47 | /** 48 | * Show the form for creating a new resource. 49 | * 50 | * @return \Illuminate\Http\Response 51 | */ 52 | public function create() 53 | { 54 | return view('categories.create'); 55 | } 56 | 57 | /** 58 | * Store a newly created resource in storage. 59 | * 60 | * @param \Illuminate\Http\Request $request 61 | * @return \Illuminate\Http\Response 62 | */ 63 | public function store(Request $request) 64 | { 65 | 66 | $validated = $request->validate([ 67 | 'name' => 'required|unique:categories', 68 | ]); 69 | 70 | $category = New Category(); 71 | $category->name = $request->input('name'); 72 | $category->status = 1; 73 | $category->user_id = $this->user->id; 74 | $category->save(); 75 | 76 | 77 | return redirect('categories')->with('success','New Category '.$category->name.' has been added!'); 78 | 79 | } 80 | 81 | /** 82 | * Display the specified resource. 83 | * 84 | * @param int $id 85 | * @return \Illuminate\Http\Response 86 | */ 87 | public function show($id) 88 | { 89 | // 90 | } 91 | 92 | /** 93 | * Show the form for editing the specified resource. 94 | * 95 | * @param int $id 96 | * @return \Illuminate\Http\Response 97 | */ 98 | public function edit($id) 99 | { 100 | $categories = Category::find($id); 101 | return view("categories.edit")->with('categories', $categories); 102 | } 103 | 104 | /** 105 | * Update the specified resource in storage. 106 | * 107 | * @param \Illuminate\Http\Request $request 108 | * @param int $id 109 | * @return \Illuminate\Http\Response 110 | */ 111 | public function update(Request $request, $id) 112 | { 113 | $validated = $request->validate([ 114 | 'name' => 'required', 115 | ]); 116 | 117 | $status_input = $request->input('status'); 118 | if (!isset($status_input)) { 119 | $status = 0; 120 | }else{ 121 | $status = 1; 122 | } 123 | $categories = Category::find($id); 124 | $categories->name = $request->input("name"); 125 | $categories->status = $status; 126 | $categories->save(); 127 | return redirect("categories")->with("success", "Category ".$request->input('name'). "have been Updated!"); 128 | } 129 | 130 | /** 131 | * Remove the specified resource from storage. 132 | * 133 | * @param int $id 134 | * @return \Illuminate\Http\Response 135 | */ 136 | public function destroy($id) 137 | { 138 | // 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /public/svg/404.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/borrowers/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends( (Auth::user()->user_type == 2) ? 'layouts.admin' : 'layouts.app') 2 | @section('content') 3 |
4 |
5 |
6 | id)) { 8 | redirect('home'); 9 | } 10 | ?> 11 |
12 | @method('put') 13 | @csrf 14 |
15 |
16 |

Return Book

17 |
18 |
19 | 20 | 21 | User's Email Address 22 |
23 |
24 | 25 | 26 | Book's Name 27 |
28 |
29 | 30 | 31 | Borrowed Book 32 |
33 | {{--
34 |
35 | 36 | 37 | 38 |
39 |
--}} 40 | 41 | 42 | 43 | 46 |
47 |
48 | 49 | 72 |
73 |
74 |
75 |
76 | @endsection 77 | --------------------------------------------------------------------------------