From b4fa75eec08e7802edd439b021324aa7673782b0 Mon Sep 17 00:00:00 2001 From: nchlsc Date: Thu, 6 Apr 2017 01:29:13 +0800 Subject: [PATCH] new functions --- .env.example | 0 .gitattributes | 0 .gitignore | 0 README.md | 96 ++++--- app/Bid.php | 10 + app/Console/Kernel.php | 0 app/Exceptions/Handler.php | 0 .../Auth/ForgotPasswordController.php | 32 +++ app/Http/Controllers/Auth/LoginController.php | 39 +++ .../Controllers/Auth/RegisterController.php | 81 ++++++ .../Auth/RegistrationController.php | 61 ---- .../Auth/ResetPasswordController.php | 39 +++ .../Controllers/Auth/SessionsController.php | 71 ----- app/Http/Controllers/Controller.php | 0 app/Http/Controllers/HomeController.php | 25 +- .../Controllers/Resources/BidsController.php | 0 .../Controllers/Resources/TasksController.php | 37 ++- .../Controllers/Resources/UsersController.php | 0 app/Http/Kernel.php | 0 app/Http/Middleware/EncryptCookies.php | 0 .../Middleware/RedirectIfAuthenticated.php | 0 app/Http/Middleware/TrimStrings.php | 0 app/Http/Middleware/VerifyCsrfToken.php | 0 app/Mail/Welcome.php | 0 app/Providers/AppServiceProvider.php | 2 + app/Providers/AuthServiceProvider.php | 0 app/Providers/BroadcastServiceProvider.php | 0 app/Providers/EventServiceProvider.php | 0 app/Providers/RouteServiceProvider.php | 0 app/Repositories/Bids.php | 41 +-- app/Repositories/Logins.php | 33 --- app/Repositories/Tasks.php | 40 +-- app/Repositories/Users.php | 0 app/Task.php | 12 + app/User.php | 0 artisan | 0 bootstrap/app.php | 0 bootstrap/autoload.php | 0 bootstrap/cache/.gitignore | 0 composer.json | 0 composer.lock | 34 +-- config/app.php | 0 config/auth.php | 0 config/broadcasting.php | 0 config/cache.php | 0 config/database.php | 0 config/filesystems.php | 0 config/mail.php | 0 config/queue.php | 0 config/services.php | 0 config/session.php | 0 config/view.php | 0 database/.gitignore | 0 database/beta-taskr.sql | 265 ------------------ database/factories/ModelFactory.php | 0 .../2014_10_12_000000_create_users_table.php | 2 +- ...12_100000_create_password_resets_table.php | 0 .../2017_02_25_115414_create_tasks_table.php | 5 +- .../2017_02_27_011404_create_bids_table.php | 4 +- .../2017_03_30_232421_create_logins_table.php | 37 --- ...3_21_174543_create_generic_tasks_table.php | 0 database/seeds/DatabaseSeeder.php | 0 package.json | 0 phpunit.xml | 0 public/.htaccess | 0 public/css/app.css | 0 public/favicon.ico | 0 public/fonts/glyphicons-halflings-regular.eot | Bin public/fonts/glyphicons-halflings-regular.svg | 0 public/fonts/glyphicons-halflings-regular.ttf | Bin .../fonts/glyphicons-halflings-regular.woff | Bin .../fonts/glyphicons-halflings-regular.woff2 | Bin public/index.php | 0 public/js/app.js | 0 public/js/scripts.js | 0 public/mix-manifest.json | 0 public/robots.txt | 0 public/web.config | 0 resources/assets/js/app.js | 0 resources/assets/js/bootstrap.js | 0 resources/assets/sass/_variables.scss | 0 resources/assets/sass/app.scss | 0 resources/lang/en/auth.php | 0 resources/lang/en/pagination.php | 0 resources/lang/en/passwords.php | 0 resources/lang/en/validation.php | 0 .../create.blade.php => auth/login.blade.php} | 6 +- .../views/auth/passwords/email.blade.php | 47 ++++ .../views/auth/passwords/reset.blade.php | 79 ++++++ .../register.blade.php} | 4 +- resources/views/bids/create.blade.php | 0 resources/views/bids/show.blade.php | 0 resources/views/emails/welcome.blade.php | 0 resources/views/errors/403.blade.php | 0 resources/views/errors/404.blade.php | 0 resources/views/home.blade.php | 72 ++++- resources/views/layouts/app.blade.php | 0 resources/views/layouts/errors.blade.php | 0 resources/views/layouts/footer.blade.php | 0 resources/views/layouts/nav.blade.php | 0 resources/views/tasks/create.blade.php | 0 resources/views/tasks/edit.blade.php | 2 +- resources/views/tasks/index.blade.php | 0 resources/views/tasks/listing.blade.php | 54 +--- resources/views/tasks/search.blade.php | 39 +++ resources/views/tasks/show.blade.php | 99 ++++--- resources/views/users/index.blade.php | 0 resources/views/users/listing.blade.php | 0 resources/views/users/show.blade.php | 0 routes/api.php | 0 routes/channels.php | 1 + routes/console.php | 0 routes/web.php | 35 ++- server.php | 0 storage/app/.gitignore | 0 storage/app/public/.gitignore | 0 storage/framework/.gitignore | 0 storage/framework/cache/.gitignore | 0 storage/framework/sessions/.gitignore | 0 storage/framework/views/.gitignore | 0 storage/logs/.gitignore | 0 tests/CreatesApplication.php | 0 tests/Feature/ExampleTest.php | 0 tests/TestCase.php | 0 tests/Unit/ExampleTest.php | 0 webpack.mix.js | 0 yarn.lock | 0 127 files changed, 669 insertions(+), 735 deletions(-) mode change 100644 => 100755 .env.example mode change 100644 => 100755 .gitattributes mode change 100644 => 100755 .gitignore mode change 100644 => 100755 README.md mode change 100644 => 100755 app/Bid.php mode change 100644 => 100755 app/Console/Kernel.php mode change 100644 => 100755 app/Exceptions/Handler.php create mode 100755 app/Http/Controllers/Auth/ForgotPasswordController.php create mode 100755 app/Http/Controllers/Auth/LoginController.php create mode 100755 app/Http/Controllers/Auth/RegisterController.php delete mode 100644 app/Http/Controllers/Auth/RegistrationController.php create mode 100755 app/Http/Controllers/Auth/ResetPasswordController.php delete mode 100644 app/Http/Controllers/Auth/SessionsController.php mode change 100644 => 100755 app/Http/Controllers/Controller.php mode change 100644 => 100755 app/Http/Controllers/HomeController.php mode change 100644 => 100755 app/Http/Controllers/Resources/BidsController.php mode change 100644 => 100755 app/Http/Controllers/Resources/TasksController.php mode change 100644 => 100755 app/Http/Controllers/Resources/UsersController.php mode change 100644 => 100755 app/Http/Kernel.php mode change 100644 => 100755 app/Http/Middleware/EncryptCookies.php mode change 100644 => 100755 app/Http/Middleware/RedirectIfAuthenticated.php mode change 100644 => 100755 app/Http/Middleware/TrimStrings.php mode change 100644 => 100755 app/Http/Middleware/VerifyCsrfToken.php mode change 100644 => 100755 app/Mail/Welcome.php mode change 100644 => 100755 app/Providers/AppServiceProvider.php mode change 100644 => 100755 app/Providers/AuthServiceProvider.php mode change 100644 => 100755 app/Providers/BroadcastServiceProvider.php mode change 100644 => 100755 app/Providers/EventServiceProvider.php mode change 100644 => 100755 app/Providers/RouteServiceProvider.php mode change 100644 => 100755 app/Repositories/Bids.php delete mode 100644 app/Repositories/Logins.php mode change 100644 => 100755 app/Repositories/Tasks.php mode change 100644 => 100755 app/Repositories/Users.php mode change 100644 => 100755 app/Task.php mode change 100644 => 100755 app/User.php mode change 100644 => 100755 artisan mode change 100644 => 100755 bootstrap/app.php mode change 100644 => 100755 bootstrap/autoload.php mode change 100644 => 100755 bootstrap/cache/.gitignore mode change 100644 => 100755 composer.json mode change 100644 => 100755 composer.lock mode change 100644 => 100755 config/app.php mode change 100644 => 100755 config/auth.php mode change 100644 => 100755 config/broadcasting.php mode change 100644 => 100755 config/cache.php mode change 100644 => 100755 config/database.php mode change 100644 => 100755 config/filesystems.php mode change 100644 => 100755 config/mail.php mode change 100644 => 100755 config/queue.php mode change 100644 => 100755 config/services.php mode change 100644 => 100755 config/session.php mode change 100644 => 100755 config/view.php mode change 100644 => 100755 database/.gitignore delete mode 100644 database/beta-taskr.sql mode change 100644 => 100755 database/factories/ModelFactory.php mode change 100644 => 100755 database/migrations/2014_10_12_000000_create_users_table.php mode change 100644 => 100755 database/migrations/2014_10_12_100000_create_password_resets_table.php mode change 100644 => 100755 database/migrations/2017_02_25_115414_create_tasks_table.php mode change 100644 => 100755 database/migrations/2017_02_27_011404_create_bids_table.php delete mode 100644 database/migrations/2017_03_30_232421_create_logins_table.php rename database/{migrations => seeds}/2017_03_21_174543_create_generic_tasks_table.php (100%) mode change 100644 => 100755 mode change 100644 => 100755 database/seeds/DatabaseSeeder.php mode change 100644 => 100755 package.json mode change 100644 => 100755 phpunit.xml mode change 100644 => 100755 public/.htaccess mode change 100644 => 100755 public/css/app.css mode change 100644 => 100755 public/favicon.ico mode change 100644 => 100755 public/fonts/glyphicons-halflings-regular.eot mode change 100644 => 100755 public/fonts/glyphicons-halflings-regular.svg mode change 100644 => 100755 public/fonts/glyphicons-halflings-regular.ttf mode change 100644 => 100755 public/fonts/glyphicons-halflings-regular.woff mode change 100644 => 100755 public/fonts/glyphicons-halflings-regular.woff2 mode change 100644 => 100755 public/index.php mode change 100644 => 100755 public/js/app.js mode change 100644 => 100755 public/js/scripts.js mode change 100644 => 100755 public/mix-manifest.json mode change 100644 => 100755 public/robots.txt mode change 100644 => 100755 public/web.config mode change 100644 => 100755 resources/assets/js/app.js mode change 100644 => 100755 resources/assets/js/bootstrap.js mode change 100644 => 100755 resources/assets/sass/_variables.scss mode change 100644 => 100755 resources/assets/sass/app.scss mode change 100644 => 100755 resources/lang/en/auth.php mode change 100644 => 100755 resources/lang/en/pagination.php mode change 100644 => 100755 resources/lang/en/passwords.php mode change 100644 => 100755 resources/lang/en/validation.php rename resources/views/{sessions/create.blade.php => auth/login.blade.php} (93%) mode change 100644 => 100755 create mode 100755 resources/views/auth/passwords/email.blade.php create mode 100755 resources/views/auth/passwords/reset.blade.php rename resources/views/{registration/create.blade.php => auth/register.blade.php} (95%) mode change 100644 => 100755 create mode 100755 resources/views/bids/create.blade.php create mode 100755 resources/views/bids/show.blade.php mode change 100644 => 100755 resources/views/emails/welcome.blade.php mode change 100644 => 100755 resources/views/errors/403.blade.php mode change 100644 => 100755 resources/views/errors/404.blade.php mode change 100644 => 100755 resources/views/home.blade.php mode change 100644 => 100755 resources/views/layouts/app.blade.php mode change 100644 => 100755 resources/views/layouts/errors.blade.php mode change 100644 => 100755 resources/views/layouts/footer.blade.php mode change 100644 => 100755 resources/views/layouts/nav.blade.php mode change 100644 => 100755 resources/views/tasks/create.blade.php mode change 100644 => 100755 resources/views/tasks/edit.blade.php mode change 100644 => 100755 resources/views/tasks/index.blade.php mode change 100644 => 100755 resources/views/tasks/listing.blade.php create mode 100755 resources/views/tasks/search.blade.php mode change 100644 => 100755 resources/views/tasks/show.blade.php mode change 100644 => 100755 resources/views/users/index.blade.php mode change 100644 => 100755 resources/views/users/listing.blade.php mode change 100644 => 100755 resources/views/users/show.blade.php mode change 100644 => 100755 routes/api.php mode change 100644 => 100755 routes/channels.php mode change 100644 => 100755 routes/console.php mode change 100644 => 100755 routes/web.php mode change 100644 => 100755 server.php mode change 100644 => 100755 storage/app/.gitignore mode change 100644 => 100755 storage/app/public/.gitignore mode change 100644 => 100755 storage/framework/.gitignore mode change 100644 => 100755 storage/framework/cache/.gitignore mode change 100644 => 100755 storage/framework/sessions/.gitignore mode change 100644 => 100755 storage/framework/views/.gitignore mode change 100644 => 100755 storage/logs/.gitignore mode change 100644 => 100755 tests/CreatesApplication.php mode change 100644 => 100755 tests/Feature/ExampleTest.php mode change 100644 => 100755 tests/TestCase.php mode change 100644 => 100755 tests/Unit/ExampleTest.php mode change 100644 => 100755 webpack.mix.js mode change 100644 => 100755 yarn.lock diff --git a/.env.example b/.env.example old mode 100644 new mode 100755 diff --git a/.gitattributes b/.gitattributes old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index b81272a..167d71c --- a/README.md +++ b/README.md @@ -1,58 +1,66 @@ +# DO NOT PUSH ANYTHING TO MASTER. ALL WORK SHOULD BE DONE ON A SEPARATE BRANCH AND MERGED IN +# THERE HAS BEEN TOO MUCH BROKEN CODE PUSHED TO MASTER + # Project Information ## About Project -Taskr is task sourcing platform for people to outsource tasks to others who wants to make a quick living from it. Taskr is built on Laravel framework using PHP 7.1 and currently developed by a group of five developers. + +Taskr is task sourcing platform for people to outsource tasks to others who wants to make a quick living from it. Taskr is currently ## Setting Your Dev Environment -> ###### As this project is not meant to be production ready, it is advisable to perform the same steps below when deploying the application for production. - -#### Follow the steps below to replicate the environment required for development. There are two ways to setup _Taskr_ where one involves in running the environment in a virtual machine while the other in your local machine. It is up to your discretion in the choice made. - -### Using Homestead (Recommended) -1. Install and Configure Homestead by following this [guide](https://laravel.com/docs/5.4/homestead). - 1. When configuring the `sites` in `homestead.yaml`, use the code block below and replace the folder path with the actual path - ``` - sites: - - map: homestead.app - to: {folder_path}/public - ``` -2. Start Homestead by `vagrant up` and SSH into Homestead using `vagrant ssh`. -3. Navigate into the project folder within the SSH session and run `composer install` to get PHP dependencies. -4. Run `yarn` to install Javascript dependencies (e.g. jQuery, Bootstrap, etc.). -5. Run `cp .env.example .env` and modify the .env file using your favourite editor e.g. `nano`, `vim`, `sublime` -6. From [Laravel Homestead](https://laravel.com/docs/5.4/homestead) guide, put in the username and password of the PostgreSQL into .env. defaults: `username: homestead, password: secret` -7. Login to PostgreSQL database by running `psql -U homestead -h localhost` and create database using `CREATE DATABASE taskr` within `psql` shell. -8. Generate an application key for laravel by running the command `php artisan key:generate`. -9. Run database migrations to setup the database tables automatically using `php artisan migrate`. - 1. You can also execute database setup code using the SQL file provided `psql -U homestead -h localhost example.sql`. -10. If configured properly in the guide found in step 1, your application should be accessible from your local machine through the domain you have configured. - -### Using XAMP (LAMP, MAMP, WAMP) Stack -1. Installing the pre-requisites using one-click installers provided by Bitnami below. Choose your stack based on your host operating system. - 1. https://bitnami.com/stack/lamp (Linux) - 2. https://bitnami.com/stack/wamp (Windows) - 3. https://bitnami.com/stack/mamp (MacOS) -2. Install `composer` onto your machine from https://getcomposer.org/. -3. Navigate to the project folder and run `composer install` to install PHP dependencies. -4. In the same folder, run `yarn` to install Javascript dependencies (e.g. jQuery, Bootstrap, etc.). -5. Create `.env` file and copy `.env.example` content into it. Configure `.env` information with respect to your host configuration. -6. Access your `postgreSQL` database using `phpPgAdmin` and create a new database called `taskr`. -7. Run database migrations to setup the database tables automatically using `php artisan migrate`. - 1. You can also execute database setup code using the SQL file provided `psql -U {your_username} -h localhost example.sql`. -8. Ensure that your project folder is in your Apache folder (e.g. Linux - /var/www/html) and it has writable permissions. -9. Navigate to the site based on your Apache settings using your browser. +1. Configure Homestead by following this [guide](https://laravel.com/docs/5.4/homestead). +2. Start Homestead by `vagrant up` and SSH into it using `vagrant ssh`. +3. Navigate into the project folder within the SSH session and run `composer install` to get dependencies. +4. Run `yarn` to get javascript dependencies (e.g. jquery, bootstrap, etc.). +5. Execute `cp .env.example .env` and modify the .env file using your favourite editor e.g. `nano`, `vim` +6. From [Laravel Homestead](https://laravel.com/docs/5.4/homestead) guide, put in the username and password of the PostgreSQL into .env. +7. Login to PostgreSQL database using shell commands or Datagrip and create database called `taskr`. +8. To generate an application key, run the command `php artisan key:generate`. +9. Run database migrations to setup the tables using `php artisan migrate:reset`. +10. If configured properly in step 1, your application should be accessible from your machine through the domain you configured. ## Database Models and Manipulation -Due to the restrictions against ORMs (Eloquent), the project requires the execution of raw queries instead. To understand how to do that in Laravel, take a look at their [documentation](https://laravel.com/docs/5.4/database#running-queries) to learn more. +Due to the restrictions against ORMs (Eloquent), the project requires the execution of raw queries instead. To understand how to do that in Laravel, take a look at their [documentation](https://laravel.com/docs/5.4/database#running-queries) to learn more. + +# Laravel Information +--- +

+ +

+Build Status +Total Downloads +Latest Stable Version +License +

+ +## About Laravel + +Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: + +- [Simple, fast routing engine](https://laravel.com/docs/routing). +- [Powerful dependency injection container](https://laravel.com/docs/container). +- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. +- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). +- Database agnostic [schema migrations](https://laravel.com/docs/migrations). +- [Robust background job processing](https://laravel.com/docs/queues). +- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). -## Populate the database with fake data -Run the SQL queries in database/beta-taskr.sql -User with credentials u/test@gmail.com p/123456 has all data needed to explore all of taskr's functionality. +Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation give you tools you need to build any application with which you are tasked. ## Learning Laravel + Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is thorough, complete, and makes it a breeze to get started learning the framework. If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 900 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library. -## Developer Announcement -Due to too many broken code pushed directly into the master branch, everyone should be developing within their branches and making pull request when trying to merge back into master. +## Contributing + +Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions). + +## Security Vulnerabilities + +If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed. + +## License + +The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT). diff --git a/app/Bid.php b/app/Bid.php old mode 100644 new mode 100755 index 4c2f941..e7f771d --- a/app/Bid.php +++ b/app/Bid.php @@ -28,4 +28,14 @@ class Bid extends Model | methods for code readability and reuse. | */ + + public function task() + { + return $this->belongsTo(Task::class); + } + + public function user() + { + return $this->belongsTo(User::class); + } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php old mode 100644 new mode 100755 diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php old mode 100644 new mode 100755 diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php new file mode 100755 index 0000000..298e8d5 --- /dev/null +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -0,0 +1,32 @@ +middleware('guest'); + } +} diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php new file mode 100755 index 0000000..cf6d1f8 --- /dev/null +++ b/app/Http/Controllers/Auth/LoginController.php @@ -0,0 +1,39 @@ +middleware('guest', ['except' => 'logout']); + } +} diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php new file mode 100755 index 0000000..a1d81ae --- /dev/null +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -0,0 +1,81 @@ +middleware('guest'); + } + + /** + * Get a validator for an incoming registration request. + * + * @param array $data + * + * @return \Illuminate\Contracts\Validation\Validator + */ + protected function validator(array $data) + { + return Validator::make($data, [ + 'first_name' => 'required|max:255', + 'last_name' => 'required|max:255', + 'email' => 'required|email|max:255|unique:users', + 'password' => 'required|min:6|confirmed' + ]); + } + + /** + * Create a new user instance after a valid registration. + * + * @param array $data + * + * @return User + */ + protected function create(array $data) + { + $user = User::create([ + 'first_name' => $data['first_name'], + 'last_name' => $data['last_name'], + 'email' => $data['email'], + 'password' => bcrypt($data['password']), + 'is_admin' => false, + ]); + + //\Mail::to($user)->send(new Welcome($user)); + + return $user; + } +} diff --git a/app/Http/Controllers/Auth/RegistrationController.php b/app/Http/Controllers/Auth/RegistrationController.php deleted file mode 100644 index 34619d3..0000000 --- a/app/Http/Controllers/Auth/RegistrationController.php +++ /dev/null @@ -1,61 +0,0 @@ -loginsRepo = $logins; - } - - public function create() - { - return view('registration.create'); - } - - public function store() - { - // Validate the form - $this->validate(request(), [ - 'first_name' => 'required|max:255', - 'last_name' => 'required|max:255', - 'email' => 'required|email|max:255|unique:users', - 'password' => 'required|min:6|confirmed' - ]); - - // Create and save the user - $isCreated = DB::insert('insert into users (first_name, last_name, email, password, is_admin) values (?, ?, ?, ?, ?)', - [request('first_name'), request('last_name'), request('email'), Hash::make(request('password')), false]); - - if ($isCreated) { - $results = DB::select('SELECT * FROM users WHERE email = ?', [request('email')]); - - // Create new user object and store information into it - $user = new \Taskr\User; - $user->id = $results[0]->id; - $user->first_name = request('first_name'); - $user->last_name = request('last_name'); - $user->email = request('email'); - $user->is_admin = request('is_admin'); - session(['last_login_id' => $this->loginsRepo->recordLogin($user->id)]); - // Login the user into laravel authentication and redirect to home - auth()->login($user); - return redirect()->home(); - } else { - // throw some error that insertion has failed. violate unique constraints? - request()->flash(); - return back()->withErrors([ - 'message' => 'There is something wrong with your registration. Try again later.' - ]); - } - } -} diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php new file mode 100755 index 0000000..c389a3d --- /dev/null +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -0,0 +1,39 @@ +middleware('guest'); + } +} diff --git a/app/Http/Controllers/Auth/SessionsController.php b/app/Http/Controllers/Auth/SessionsController.php deleted file mode 100644 index 198a82f..0000000 --- a/app/Http/Controllers/Auth/SessionsController.php +++ /dev/null @@ -1,71 +0,0 @@ -loginsRepo = $logins; - $this->middleware('guest', ['except' => 'destroy']); - } - - /** - * Return the view of the login page. - */ - public function create() - { - return view('sessions.create'); - } - - // Attempts to authenticate the user and login him/her into the application. - public function store() - { - // Validate the form - $this->validate(request(), [ - 'email' => 'required|email|max:255', - 'password' => 'required|min:6' - ]); - - // search for user in the database - $results = array_filter(DB::select('SELECT * FROM users WHERE email = ?', [request('email')])); - - // if there is a match for both email and password, login the user - if (!empty($results) && Hash::check(request('password'), $results[0]->password)) { - // Create new user object and store information into it - $user = new \Taskr\User; - $user->id = $results[0]->id; - $user->first_name = request('first_name'); - $user->last_name = request('last_name'); - $user->email = request('email'); - $user->is_admin = request('is_admin'); - session(['last_login_id' => $this->loginsRepo->recordLogin($user->id)]); - auth()->login($user); - return redirect()->home(); - } else { - // redirect them back since authentication fail - request()->flash(); - return back()->withErrors([ - 'message' => 'Please check your credentials and try again.' - ]); - } - } - - /** - * Logout the user from the application. - */ - public function destroy() - { - $this->loginsRepo->recordLogout(session('last_login_id')); - auth()->logout(); - return redirect()->home(); - } -} diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php old mode 100644 new mode 100755 diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php old mode 100644 new mode 100755 index 155e2db..290d679 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -32,32 +32,41 @@ public function index() $tasks = $this->tasksRepo->belongsTo($id); $bids = $this->bidsRepo->getOpenedBids($id); $selectedBids = $this->bidsRepo->getSelectedBids($id); - $numOpenBids = $this->bidsRepo->getNumOpenedBids($id); - $numTasks = $this->tasksRepo->getNumTasks($id); - $numSelectedBids = $this->bidsRepo->getNumSelectedBids($id); // formatting times - foreach($tasks as $task){ + foreach ($tasks as $task) { $strToTime = strToTime($task->start_date); $task->start_date = date('Y-m-d H:i', $strToTime); $strToTime = strToTime($task->end_date); $task->end_date = date('Y-m-d H:i', $strToTime); } - foreach($bids as $bid){ + foreach ($bids as $bid) { $strToTime = strToTime($bid->start_date); $bid->start_date = date('Y-m-d H:i', $strToTime); $strToTime = strToTime($bid->end_date); $bid->end_date = date('Y-m-d H:i', $strToTime); } - foreach($selectedBids as $selectedBid){ + foreach ($selectedBids as $selectedBid) { $strToTime = strToTime($selectedBid->start_date); $selectedBid->start_date = date('Y-m-d H:i', $strToTime); $strToTime = strToTime($selectedBid->end_date); $selectedBid->end_date = date('Y-m-d H:i', $strToTime); } } - return view('home', compact('tasks', 'bids', 'selectedBids', 'numOpenBids', 'numTasks', 'numSelectedBids')); + + + $user_id = \Illuminate\Support\Facades\Auth::user()->id; + + $maxprice= \Illuminate\Support\Facades\DB::table('bids')->join('tasks','bids.user_id','=','tasks.owner')->where('bids.user_id',$user_id)->max('price'); + + $user_id = \Illuminate\Support\Facades\Auth::user()->id; + + $countbids= \Illuminate\Support\Facades\DB::table('bids')->join('tasks','bids.user_id','=','tasks.owner')->where('bids.user_id',$user_id)->count() ; + + + return view('home', compact('tasks', 'bids', 'selectedBids'))->with('maxprice',$maxprice)->with('countbids',$countbids); } -} + +} \ No newline at end of file diff --git a/app/Http/Controllers/Resources/BidsController.php b/app/Http/Controllers/Resources/BidsController.php old mode 100644 new mode 100755 diff --git a/app/Http/Controllers/Resources/TasksController.php b/app/Http/Controllers/Resources/TasksController.php old mode 100644 new mode 100755 index 38699a1..580a8ad --- a/app/Http/Controllers/Resources/TasksController.php +++ b/app/Http/Controllers/Resources/TasksController.php @@ -2,12 +2,12 @@ namespace Taskr\Http\Controllers\Resources; +use Illuminate\Support\Facades\Log; use \stdClass; use Illuminate\Support\Facades\Auth; use Taskr\Http\Controllers\Controller; use Taskr\Repositories\Tasks; use Taskr\Repositories\Users; -use Taskr\Repositories\Bids; use Illuminate\Support\Facades\Validator; use Taskr\Task; use Illuminate\Http\Request; @@ -23,13 +23,11 @@ class TasksController extends Controller { protected $tasksRepo; protected $usersRepo; - protected $bidsRepo; - public function __construct(Tasks $tasks, Users $users, Bids $bids) + public function __construct(Tasks $tasks, Users $users) { $this->tasksRepo = $tasks; $this->usersRepo = $users; - $this->bidsRepo = $bids; } /* @@ -54,14 +52,11 @@ public function index() public function show(Task $task) { $user = new stdClass(); - $bids = []; if (Auth::check()) { $id = Auth::id(); $user = $this->usersRepo->getUser($id); - $bids = $this->bidsRepo->getBids($task->id); - $taskOwner = $this->usersRepo->getUser($task->owner); } - return view('tasks.show', compact('task', 'user', 'bids', 'taskOwner')); + return view('tasks.show', compact('task', 'user')); } public function create() @@ -76,6 +71,30 @@ public function edit(Task $task) return view('tasks.edit', compact('task', 'generic_tasks')); } + public function search(Request $request) + { + $query = $request->q; + $tasks = Task::where('title','LIKE', "%$query%")->get(); + //->orWhere('created_at','=', "$query")->orWhere('category','LIKE',"%$query%")->orWhere('start_date','=',"$query")->orWhere('end_date','=',"%$query%")->get(); + + Log::info($tasks); + return view('tasks.search')->with('details',$tasks)->with('query',$query); + // if(count($tasks) > 0){ + // return view('tasks.search')->withDetails($tasks)->withQuery($query); + // } + // else { + // return view ('tasks.search')->withMessage('No such task found. Try searching again!'); + // }; + + // $keyword= Input::get('q'); + + // $task = Task::find($keyword); + + // return view::make('tasks.search', compact('tasks', 'user')); + + // //$task->show(); + } + /* |-------------------------------------------------------------------------- | Resource Methods @@ -88,7 +107,7 @@ public function edit(Task $task) public function update(Request $request, Task $task) { $this->validateTask($request); - $this->tasksRepo->update($task->id, + $this->tasksRepo->update($task->id, $request->input('title'), $request->input('description'), $request->input('category'), diff --git a/app/Http/Controllers/Resources/UsersController.php b/app/Http/Controllers/Resources/UsersController.php old mode 100644 new mode 100755 diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php old mode 100644 new mode 100755 diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php old mode 100644 new mode 100755 diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php old mode 100644 new mode 100755 diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php old mode 100644 new mode 100755 diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php old mode 100644 new mode 100755 diff --git a/app/Mail/Welcome.php b/app/Mail/Welcome.php old mode 100644 new mode 100755 diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php old mode 100644 new mode 100755 index 738c630..2f38112 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace Taskr\Providers; +use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -14,6 +15,7 @@ class AppServiceProvider extends ServiceProvider public function boot() { // + Schema::defaultStringLength(191); } /** diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php old mode 100644 new mode 100755 diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php old mode 100644 new mode 100755 diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php old mode 100644 new mode 100755 diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php old mode 100644 new mode 100755 diff --git a/app/Repositories/Bids.php b/app/Repositories/Bids.php old mode 100644 new mode 100755 index c4c448c..bac5131 --- a/app/Repositories/Bids.php +++ b/app/Repositories/Bids.php @@ -17,7 +17,7 @@ class Bids { public function all() { - $tasks = DB::select('SELECT * FROM bids'); + $tasks = DB::select('select * from bids'); return $tasks; } @@ -30,50 +30,15 @@ public function belongsTo($id) public function getOpenedBids($id) { - $bids = DB::select('SELECT * FROM Bids b, Tasks t, Users u WHERE b.user_id=? + $bids = DB::select('SELECT * FROM Bids b, Tasks t, Users u WHERE user_id=? AND b.task_id = t.id AND t.owner = u.id AND t.status=0', [$id]); return $bids; } public function getSelectedBids($id) { - $bids = DB::select('SELECT * FROM Bids b, Tasks t, Users u WHERE b.user_id=? + $bids = DB::select('SELECT * FROM Bids b, Tasks t, Users u WHERE user_id=? AND b.task_id = t.id AND t.owner = u.id AND b.selected=true', [$id]); return $bids; } - - public function getBids($taskId) - { - $bids = DB::select('SELECT b.*, u.first_name, u.last_name FROM Bids b INNER JOIN Users u ON u.id = b.user_id WHERE b.task_id=?', - [$taskId]); - return $bids; - } - - public function deleteBid($id) - { - $deleted = DB::delete('DELETE FROM users WHERE id = ?', [$id]); - return $deleted; - } - - public function insertBid($taskId, $userId, $price) - { - $bid = DB::insert('INSERT INTO users (task_id, user_id, price) VALUES (?, ?, ?)', [$taskId, $userId, $price]); - return $bid; - } - - public function getNumOpenedBids($id) { - return array_filter( - DB::select('SELECT COUNT(*) FROM Bids b, Tasks t WHERE user_id = ? AND b.task_id = t.id AND t.status = 0', [$id]))[0]->count; - } - - public function getNumSelectedBids($id) { - return array_filter( - DB::select('SELECT COUNT(*) FROM Bids b WHERE b.user_id = ? AND b.selected=true', [$id]))[0]->count; - } - - public function updateBid($bid) - { - DB::update('UPDATE users SET task_id = ?, user_id = ?, price = ? WHERE id = ?', - [$bid->task_id, $bid->user_id, $bid->price, $bid->id]); - } } diff --git a/app/Repositories/Logins.php b/app/Repositories/Logins.php deleted file mode 100644 index 0fd22c6..0000000 --- a/app/Repositories/Logins.php +++ /dev/null @@ -1,33 +0,0 @@ -now()]); - return DB::getPdo()->lastInsertId(); - } - - public function recordLogout($id) { - DB::update("UPDATE Logins SET logout_time = ? WHERE id = ?", [$this->now(), $id]); - } - - private function now() { - date_default_timezone_set('UTC'); - - // Then call the date functions - return date('Y-m-d H:i:s'); - } -} diff --git a/app/Repositories/Tasks.php b/app/Repositories/Tasks.php old mode 100644 new mode 100755 index f1241e4..f18dd8b --- a/app/Repositories/Tasks.php +++ b/app/Repositories/Tasks.php @@ -17,48 +17,38 @@ class Tasks { public function all() { - $tasks = DB::select('SELECT tasks.*, users.first_name, users.last_name FROM tasks INNER JOIN users ON tasks.owner = users.id'); + $tasks = DB::select('select * from tasks'); return $tasks; } public function belongsTo($id) { - $tasks = DB::select('SELECT t.id, t.title, t.description, t.category, t.owner, t.status, t.start_date, t.end_date, - COUNT(b2.id) AS total_bids, - (SELECT COUNT(*) FROM Bids b WHERE b.task_id = t.id AND b.created_at > ANY(SELECT l.logout_time FROM Logins l WHERE l.user_id = ? - AND l.logout_time >= ALL( - SELECT l2.logout_time FROM Logins l2 WHERE l.user_id = ? AND l2.logout_time IS NOT NULL))) - AS new_bids FROM Tasks t LEFT OUTER JOIN Bids b2 ON b2.task_id = t.id WHERE t.owner=? - GROUP BY t.id, t.title, t.description, t.category, t.owner, t.status, t.start_date, t.end_date', [$id, $id, $id]); + $tasks = DB::select('SELECT * FROM Tasks WHERE owner=?', [$id]); return $tasks; } - public function delete($id) - { + public function delete($id) { DB::delete("DELETE FROM tasks WHERE id = ?", [$id]); } - public function insert($title, $description, $category, $owner, $status, $start_date, $end_date) - { - DB::insert("INSERT INTO tasks (title, description, category, owner, status, start_date, end_date) VALUES (?, ?, ?, ?, ?, ?, ?)", + public function insert($title, $description, $category, $owner, $status, $start_date, $end_date) { + DB::insert("INSERT INTO tasks (title, description, category, owner, status, start_date, end_date) values (?, ?, ?, ?, ?, ?, ?)", [$title, $description, $category, $owner, $status, $start_date, $end_date]); } - public function update($id, $title, $description, $category, $start_date, $end_date) - { - DB::update("UPDATE tasks SET title = ?, description = ?, category = ?, start_date = ?, end_date = ? WHERE id = ?", + public function update($id, $title, $description, $category, $start_date, $end_date) { + DB::update("update tasks set title = ?, description = ?, category = ?, start_date = ?, end_date = ? where id = ?", [$title, $description, $category, $start_date, $end_date, $id]); } - public function updateStatus($id, $status) - { - if ($status == 0 || $status == 1 || $status == 2) { - DB::update("UPDATE tasks SET status = ? WHERE id = ?", [$status, $id]); - } + public function updateStatus($id, $status) { + DB::update("UPDATE tasks SET status = ? WHERE id = ?", [$status, $id]); } - public function getNumTasks($id) { - return array_filter( - DB::select('SELECT COUNT(*) FROM Tasks t WHERE t.owner = ?', [$id]))[0]->count; + public function setStatus($id, $newStatus) { + if ($newStatus == 0 || $newStatus == 1 || $newStatus == 2) { + DB::update("update tasks set status = ? where id = ?", [$newStatus, $id]); + } } -} + + } diff --git a/app/Repositories/Users.php b/app/Repositories/Users.php old mode 100644 new mode 100755 diff --git a/app/Task.php b/app/Task.php old mode 100644 new mode 100755 index 2d3ec7c..9e591b1 --- a/app/Task.php +++ b/app/Task.php @@ -31,4 +31,16 @@ class Task extends Model | methods for code readability and reuse. | */ + + //TODO: Need to change to execute raw queries instead + //TODO: Need to access UserID of bid owner + public function bids() + { + return $this->hasMany(Bid::class); + } + + public function owner() + { + return $this->belongsTo(User::class); + } } diff --git a/app/User.php b/app/User.php old mode 100644 new mode 100755 diff --git a/artisan b/artisan old mode 100644 new mode 100755 diff --git a/bootstrap/app.php b/bootstrap/app.php old mode 100644 new mode 100755 diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php old mode 100644 new mode 100755 diff --git a/bootstrap/cache/.gitignore b/bootstrap/cache/.gitignore old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 diff --git a/composer.lock b/composer.lock old mode 100644 new mode 100755 index 31006b4..0f0d408 --- a/composer.lock +++ b/composer.lock @@ -108,16 +108,16 @@ }, { "name": "erusev/parsedown", - "version": "1.6.2", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01" + "reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/1bf24f7334fe16c88bf9d467863309ceaf285b01", - "reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/20ff8bbb57205368b4b42d094642a3e52dac85fb", + "reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb", "shasum": "" }, "require": { @@ -146,7 +146,7 @@ "markdown", "parser" ], - "time": "2017-03-29T16:04:15+00:00" + "time": "2016-11-02T15:56:58+00:00" }, { "name": "jakub-onderka/php-console-color", @@ -478,16 +478,16 @@ }, { "name": "league/flysystem", - "version": "1.0.37", + "version": "1.0.36", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "78b5cc4feb61a882302df4fbaf63b7662e5e4ccd" + "reference": "d9c1698582dfbfbd092ec9c5c3325f862cdb3297" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/78b5cc4feb61a882302df4fbaf63b7662e5e4ccd", - "reference": "78b5cc4feb61a882302df4fbaf63b7662e5e4ccd", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d9c1698582dfbfbd092ec9c5c3325f862cdb3297", + "reference": "d9c1698582dfbfbd092ec9c5c3325f862cdb3297", "shasum": "" }, "require": { @@ -557,7 +557,7 @@ "sftp", "storage" ], - "time": "2017-03-22T15:43:14+00:00" + "time": "2017-03-18T16:02:30+00:00" }, { "name": "monolog/monolog", @@ -955,16 +955,16 @@ }, { "name": "ramsey/uuid", - "version": "3.6.1", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "4ae32dd9ab8860a4bbd750ad269cba7f06f7934e" + "reference": "0b7bdfb180e72c8d76e75a649ced67e392201458" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/4ae32dd9ab8860a4bbd750ad269cba7f06f7934e", - "reference": "4ae32dd9ab8860a4bbd750ad269cba7f06f7934e", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/0b7bdfb180e72c8d76e75a649ced67e392201458", + "reference": "0b7bdfb180e72c8d76e75a649ced67e392201458", "shasum": "" }, "require": { @@ -976,9 +976,9 @@ }, "require-dev": { "apigen/apigen": "^4.1", - "codeception/aspect-mock": "^1.0 | ^2.0", + "codeception/aspect-mock": "1.0.0", "doctrine/annotations": "~1.2.0", - "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", + "goaop/framework": "1.0.0-alpha.2", "ircmaxell/random-lib": "^1.1", "jakub-onderka/php-parallel-lint": "^0.9.0", "mockery/mockery": "^0.9.4", @@ -1033,7 +1033,7 @@ "identifier", "uuid" ], - "time": "2017-03-26T20:37:53+00:00" + "time": "2017-03-18T15:38:09+00:00" }, { "name": "swiftmailer/swiftmailer", diff --git a/config/app.php b/config/app.php old mode 100644 new mode 100755 diff --git a/config/auth.php b/config/auth.php old mode 100644 new mode 100755 diff --git a/config/broadcasting.php b/config/broadcasting.php old mode 100644 new mode 100755 diff --git a/config/cache.php b/config/cache.php old mode 100644 new mode 100755 diff --git a/config/database.php b/config/database.php old mode 100644 new mode 100755 diff --git a/config/filesystems.php b/config/filesystems.php old mode 100644 new mode 100755 diff --git a/config/mail.php b/config/mail.php old mode 100644 new mode 100755 diff --git a/config/queue.php b/config/queue.php old mode 100644 new mode 100755 diff --git a/config/services.php b/config/services.php old mode 100644 new mode 100755 diff --git a/config/session.php b/config/session.php old mode 100644 new mode 100755 diff --git a/config/view.php b/config/view.php old mode 100644 new mode 100755 diff --git a/database/.gitignore b/database/.gitignore old mode 100644 new mode 100755 diff --git a/database/beta-taskr.sql b/database/beta-taskr.sql deleted file mode 100644 index b1cfc42..0000000 --- a/database/beta-taskr.sql +++ /dev/null @@ -1,265 +0,0 @@ -/* - * USERS - * Note: password for all users is 123456 - */ - --- admin user -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (1, 'admin', 'admin', 'admin@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '1', now()); - --- this user has a full set of data -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (2, 'test', 'user', 'test@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); - --- regular users -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (3, 'a1', 'a1', 'a1@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (4, 'a2', 'a2', 'a2@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (5,'a3', 'a3', 'a3@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (6,'a4', 'a4', 'a4@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (7,'a5', 'a5', 'a5@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (8,'a6', 'a6', 'a6@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (9,'a7', 'a7', 'a7@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (10, 'a8', 'a8', 'a8@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (11, 'a9', 'a9', 'a9@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (12, 'a10', 'a10', 'a10@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (13, 'a11', 'a11', 'a11@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (14, 'a12', 'a12', 'a12@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (15, 'a13', 'a13', 'a13@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (16, 'a14', 'a14', 'a14@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (17, 'a15', 'a15', 'a15@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (18, 'a16', 'a16', 'a16@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (19, 'a17', 'a17', 'a17@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (20, 'a18', 'a18', 'a18@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (21, 'a19', 'a19', 'a19@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); -insert into Users(id, first_name, last_name, email, password, is_admin, created_at) - values (22, 'a20', 'a20', 'a20@gmail.com', '$2y$10$Nb7TVHDGRJejc9YI73BcJe95w2BeP7y32Eg8Dimv3CorB/BVB0p2m', '0', now()); - -/* - * GENERIC TASKS - */ - -insert into generic_tasks (name, category) values ('Clean my washroom', 'Clean'); -insert into generic_tasks (name, category) values ('Clean my toilet', 'Clean'); -insert into generic_tasks (name, category) values ('Clean my tub', 'Clean'); -insert into generic_tasks (name, category) values ('Clean my sink', 'Clean'); -insert into generic_tasks (name, category) values ('Clean my kitchen', 'Clean'); -insert into generic_tasks (name, category) values ('Wash my car', 'Car Maintenance'); -insert into generic_tasks (name, category) values ('Vacuum my car', 'Car Maintenance'); -insert into generic_tasks (name, category) values ('Change oil', 'Car Maintenance'); -insert into generic_tasks (name, category) values ('Change tires', 'Car Maintenance'); -insert into generic_tasks (name, category) values ('Buy eggs', 'Groceries'); -insert into generic_tasks (name, category) values ('Buy chicken breast', 'Groceries'); -insert into generic_tasks (name, category) values ('Buy fruits', 'Groceries'); -insert into generic_tasks (name, category) values ('Walk my dog', 'Pet Care'); -insert into generic_tasks (name, category) values ('Walk my cat', 'Pet Care'); -insert into generic_tasks (name, category) values ('Groom my dog', 'Pet Care'); -insert into generic_tasks (name, category) values ('Groom my cat', 'Pet Care'); -insert into generic_tasks (name, category) values ('Mow lawn', 'Yard Work'); -insert into generic_tasks (name, category) values ('Trim bushes', 'Yard Work'); -insert into generic_tasks (name, category) values ('Cut trees', 'Yard Work'); -insert into generic_tasks (name, category) values ('Rake leaves', 'Yard Work'); - -/* - * TASKS - */ - --- open tasks -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (1,'Walk barney', 'barney is my dog', 'Pet Care', 1, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (2,'Wash barney', 'barney is my dog', 'Pet Care', 1, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (3,'Groom barney', 'barney is my dog', 'Pet Care', 1, 0, now(), '2017-12-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (4,'Feed barney', 'barney is my dog', 'Pet Care', 1, 0, now(), '2017-12-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (5,'Clean my civic', 'civic is a honda', 'Honda tasks', 2, 0, now(), '2017-08-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (6,'Change the tires on my civic', 'winter tires', 'Car', 2, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (7,'Change the seats in my hummer', 'leather seats preferred', 'Hummer', 2, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (8,'Help me prepare dinner', 'I cannot cook', 'Cooking', 3, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (9,'Help me find my goggles', 'i lost them in my house', 'Find a lost item', 4, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (10,'Help me find my dog', 'barney is my dog', 'Missing dog', 4, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (11,'Help me find my cat', 'barney is my cat', 'Missing cat', 4, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (12,'Fix my speakers', 'speakers are broken', 'Repairs', 5, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (13,'Fix my ipod', 'it is broken', 'Repairs', 5, 0, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (14,'Help me sell my broken ipod', 'it is broken and i do not want it', 'Kijiji', 5, 0, now(), '2017-05-05 11:11:11'); - --- tasks that are open but have bids - -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (15,'Help me with my homework', 'i am exchange', 'NUS', 6, 0, now(), '2017-06-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (16,'Help me pass cs2102', 'too hard', 'NUS', 7, 0, now(), '2017-07-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (17,'Build a task app', 'for cs2102', 'Homework', 7, 0, now(), '2017-09-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (18,'Build uber app', 'for cs2102', 'Homework', 7, 0, now(), '2017-01-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (19, 'Build an app', 'for cs2102', 'Projects', 7, 0, now(), '2017-05-05 11:11:11'); - --- tasks with bids - -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (20,'Teach me how to not be deadweight', 'i am a deadweight', 'Help', 7, 1, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (21,'Walk barney and bart', 'barney and bart are my dogs', 'Pet Care', 2, 1, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (22,'Wash barney and bart', 'barney is my dog', 'Pet Care', 1, 1, now(), '2017-11-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (23,'Help me pass nus', 'i am exchange', 'nus', 10, 1, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (24,'Feed my baby', 'i am a bad parent', 'family', 11, 1, now(), '2017-12-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (25,'Help me find my computer', 'i left it at the r4 lounge in pgp and somebody took it', 'pgp', 14, 1, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (26,'Help me reserve a table at pines foodcourt', 'i do not have any more tissues', 'pines foodcourt', 2, 1, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (27,'Enroll in cs2102', 'it was really hard to get into this course', 'cs2102', 13, 1, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (28,'Help me write a todo app', 'for cs2103', 'cs2103', 13, 1, now(), '2017-12-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (29,'Buy chicken thighs', 'cause gains', 'gains', 4, 1, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (30,'Buy chicken breasts', 'for gains', 'Missing dog', 4, 1, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (31,'Buy steak', 'for gains', 'Missing cat', 17, 1, now(), '2017-01-05 11:11:11'); - --- completed tasks - -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (32,'Fix my biceps', 'biceps are torn', 'Repairs', 5, 2, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (33,'Repair my windows', 'it is broken', 'Repairs', 15, 2, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (34,'Paint my garage', 'cause I do not want to do it myself', 'lazy', 5, 2, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (35,'Setup vpn', 'for security', 'security', 2, 2, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (36,'Install firefox', 'for privacy', 'privacy', 17, 2, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (37,'Install ubuntu', 'for privacy', 'privacy', 2, 2, now(), '2017-03-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (38,'Install datagrip', 'for cs2102', 'Homework', 19, 2, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (39,'Teach me sql', 'for cs2102', 'lazy', 10, 2, now(), '2017-05-05 11:11:11'); -insert into tasks (id, title, description, category, owner, status, start_date, end_date) - values (40,'Teach me how to not be deadweight again', 'i am a deadweight', 'Help', 20, 2, now(), '2017-02-05 11:11:11'); - -/* - * BIDS - */ - --- bids that have been selected -insert into bids (id, user_id, task_id, price, selected, created_at) - values (1, 20, 20, 12, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (2, 1, 21, 123, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (3, 3, 22, 121, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (4, 3, 23, 13, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (5, 5, 24, 1, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (6, 6, 25, 2, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (7, 1, 26, 112, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (8, 1, 27, 122, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (9, 3, 28, 124, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (10, 2, 29, 152, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (11, 2, 30, 1211, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (12, 18, 31, 3, true, now()); - --- bids that have not been selected - -insert into bids (id, user_id, task_id, price, selected, created_at) - values (13, 1, 20, 123, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (14, 20, 21, 1244, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (15, 5, 22, 1, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (16, 14, 23, 134, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (17, 1, 24, 12, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (18, 1, 25, 22, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (19, 3, 26, 1122, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (20, 14, 27, 22, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (21, 2, 28, 123, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (22, 2, 29, 15, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (23, 18, 30, 11, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (24, 16, 31, 31, false, now()); - --- bids that have been selected (and these tasks are already completed) - -insert into bids (id, user_id, task_id, price, selected, created_at) - values (25, 1, 32, 31, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (26, 1, 33, 31, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (27, 2, 34, 31, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (28, 3, 35, 31, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (29, 4, 36, 31, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (30, 5, 37, 31, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (31, 1, 38, 31, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (32, 3, 39, 31, true, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (33, 19, 40, 31, true, now()); - --- bids that have not been selected for tasks that are still open - -insert into bids (id, user_id, task_id, price, selected, created_at) - values (34, 2, 15, 311, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (35, 1, 16, 3133, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (36, 2, 17, 1, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (37, 1, 18, 31, false, now()); -insert into bids (id, user_id, task_id, price, selected, created_at) - values (38, 2, 19, 131, false, now()); diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php old mode 100644 new mode 100755 diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php old mode 100644 new mode 100755 index d40236c..3879e72 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -21,7 +21,7 @@ public function up() $table->string('password'); $table->boolean('is_admin'); $table->rememberToken(); - $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); + $table->timestamps(); }); } diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php old mode 100644 new mode 100755 diff --git a/database/migrations/2017_02_25_115414_create_tasks_table.php b/database/migrations/2017_02_25_115414_create_tasks_table.php old mode 100644 new mode 100755 index 7567b65..9a78ce7 --- a/database/migrations/2017_02_25_115414_create_tasks_table.php +++ b/database/migrations/2017_02_25_115414_create_tasks_table.php @@ -18,14 +18,15 @@ public function up() $table->text('title'); $table->text('description'); $table->text('category'); - $table->integer('owner'); + $table->integer('owner')->unsigned(); $table->integer('status'); $table->dateTime('start_date')->nullable(); $table->dateTime('end_date')->nullable(); $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); + /* Schema constraints */ - $table->foreign('owner')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); + $table->foreign('owner')->references('id')->on('users')->onDelete('cascade'); }); } diff --git a/database/migrations/2017_02_27_011404_create_bids_table.php b/database/migrations/2017_02_27_011404_create_bids_table.php old mode 100644 new mode 100755 index 3192793..f4d8f74 --- a/database/migrations/2017_02_27_011404_create_bids_table.php +++ b/database/migrations/2017_02_27_011404_create_bids_table.php @@ -22,8 +22,8 @@ public function up() $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); /* Schema constraints */ - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - $table->foreign('task_id')->references('id')->on('tasks')->onDelete('cascade')->onUpdate('cascade'); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->foreign('task_id')->references('id')->on('tasks')->onDelete('cascade'); }); } diff --git a/database/migrations/2017_03_30_232421_create_logins_table.php b/database/migrations/2017_03_30_232421_create_logins_table.php deleted file mode 100644 index dd542bf..0000000 --- a/database/migrations/2017_03_30_232421_create_logins_table.php +++ /dev/null @@ -1,37 +0,0 @@ -increments('id'); - $table->integer('user_id'); - $table->timestamp('login_time'); - $table->timestamp('logout_time')->nullable(); - $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); - - /* Schema constraints */ - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('logins'); - } -} diff --git a/database/migrations/2017_03_21_174543_create_generic_tasks_table.php b/database/seeds/2017_03_21_174543_create_generic_tasks_table.php old mode 100644 new mode 100755 similarity index 100% rename from database/migrations/2017_03_21_174543_create_generic_tasks_table.php rename to database/seeds/2017_03_21_174543_create_generic_tasks_table.php diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php old mode 100644 new mode 100755 diff --git a/package.json b/package.json old mode 100644 new mode 100755 diff --git a/phpunit.xml b/phpunit.xml old mode 100644 new mode 100755 diff --git a/public/.htaccess b/public/.htaccess old mode 100644 new mode 100755 diff --git a/public/css/app.css b/public/css/app.css old mode 100644 new mode 100755 diff --git a/public/favicon.ico b/public/favicon.ico old mode 100644 new mode 100755 diff --git a/public/fonts/glyphicons-halflings-regular.eot b/public/fonts/glyphicons-halflings-regular.eot old mode 100644 new mode 100755 diff --git a/public/fonts/glyphicons-halflings-regular.svg b/public/fonts/glyphicons-halflings-regular.svg old mode 100644 new mode 100755 diff --git a/public/fonts/glyphicons-halflings-regular.ttf b/public/fonts/glyphicons-halflings-regular.ttf old mode 100644 new mode 100755 diff --git a/public/fonts/glyphicons-halflings-regular.woff b/public/fonts/glyphicons-halflings-regular.woff old mode 100644 new mode 100755 diff --git a/public/fonts/glyphicons-halflings-regular.woff2 b/public/fonts/glyphicons-halflings-regular.woff2 old mode 100644 new mode 100755 diff --git a/public/index.php b/public/index.php old mode 100644 new mode 100755 diff --git a/public/js/app.js b/public/js/app.js old mode 100644 new mode 100755 diff --git a/public/js/scripts.js b/public/js/scripts.js old mode 100644 new mode 100755 diff --git a/public/mix-manifest.json b/public/mix-manifest.json old mode 100644 new mode 100755 diff --git a/public/robots.txt b/public/robots.txt old mode 100644 new mode 100755 diff --git a/public/web.config b/public/web.config old mode 100644 new mode 100755 diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js old mode 100644 new mode 100755 diff --git a/resources/assets/js/bootstrap.js b/resources/assets/js/bootstrap.js old mode 100644 new mode 100755 diff --git a/resources/assets/sass/_variables.scss b/resources/assets/sass/_variables.scss old mode 100644 new mode 100755 diff --git a/resources/assets/sass/app.scss b/resources/assets/sass/app.scss old mode 100644 new mode 100755 diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php old mode 100644 new mode 100755 diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php old mode 100644 new mode 100755 diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php old mode 100644 new mode 100755 diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php old mode 100644 new mode 100755 diff --git a/resources/views/sessions/create.blade.php b/resources/views/auth/login.blade.php old mode 100644 new mode 100755 similarity index 93% rename from resources/views/sessions/create.blade.php rename to resources/views/auth/login.blade.php index 37c49e9..b193a51 --- a/resources/views/sessions/create.blade.php +++ b/resources/views/auth/login.blade.php @@ -55,10 +55,12 @@ + + + Forgot Your Password? + - - @include('layouts.errors') diff --git a/resources/views/auth/passwords/email.blade.php b/resources/views/auth/passwords/email.blade.php new file mode 100755 index 0000000..d4a3800 --- /dev/null +++ b/resources/views/auth/passwords/email.blade.php @@ -0,0 +1,47 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
Reset Password
+
+ @if (session('status')) +
+ {{ session('status') }} +
+ @endif + +
+ {{ csrf_field() }} + +
+ + +
+ + + @if ($errors->has('email')) + + {{ $errors->first('email') }} + + @endif +
+
+ +
+
+ +
+
+
+
+
+
+
+
+@endsection diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php new file mode 100755 index 0000000..7750209 --- /dev/null +++ b/resources/views/auth/passwords/reset.blade.php @@ -0,0 +1,79 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
Reset Password
+ +
+ @if (session('status')) +
+ {{ session('status') }} +
+ @endif + +
+ {{ csrf_field() }} + + + +
+ + +
+ + + @if ($errors->has('email')) + + {{ $errors->first('email') }} + + @endif +
+
+ +
+ + +
+ + + @if ($errors->has('password')) + + {{ $errors->first('password') }} + + @endif +
+
+ +
+ +
+ + + @if ($errors->has('password_confirmation')) + + {{ $errors->first('password_confirmation') }} + + @endif +
+
+ +
+
+ +
+
+
+
+
+
+
+
+@endsection diff --git a/resources/views/registration/create.blade.php b/resources/views/auth/register.blade.php old mode 100644 new mode 100755 similarity index 95% rename from resources/views/registration/create.blade.php rename to resources/views/auth/register.blade.php index f995d90..224d2c4 --- a/resources/views/registration/create.blade.php +++ b/resources/views/auth/register.blade.php @@ -70,10 +70,10 @@
- +
-
diff --git a/resources/views/bids/create.blade.php b/resources/views/bids/create.blade.php new file mode 100755 index 0000000..e69de29 diff --git a/resources/views/bids/show.blade.php b/resources/views/bids/show.blade.php new file mode 100755 index 0000000..e69de29 diff --git a/resources/views/emails/welcome.blade.php b/resources/views/emails/welcome.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/errors/403.blade.php b/resources/views/errors/403.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php old mode 100644 new mode 100755 index d879e3a..6a8e64d --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -1,34 +1,73 @@ +

- Your Created Tasks ({{ $numTasks }}) + Your Tasks Create Task

@if (sizeOf($tasks)>0) + +
+ + + + + +
+ + + + + + + +
+ + + + +
+ + + + + + @foreach ($tasks as $key=> $task) +
+ {{$task->title}} +
+ @endforeach + - + + + @foreach ($tasks as $task) @@ -36,11 +75,6 @@ - + + + + @endforeach
Title Category Start EndBids StatusMax Bid Total Bids
{{$task->category}} {{$task->start_date}} {{$task->end_date}}{{$task->total_bids}} - @if($task->new_bids > 0) - {{$task->new_bids}} new - @endif - @php switch($task->status) { @@ -58,6 +92,12 @@ } @endphp {{ $maxprice }} {{ $countbids }} + Edit +
@@ -76,7 +116,7 @@

- Your Pending Bids ({{ $numOpenBids }}) + Your Pending Bids View Tasks

@@ -103,7 +143,7 @@
You currently have no pending bids. Click here - to find tasks to bid on. + to find tasks to complete.
@endif
@@ -114,7 +154,7 @@

- Your Assigned Tasks ({{$numSelectedBids}}) + Your Assigned Tasks

@if (sizeOf($selectedBids)>0) @@ -191,3 +231,5 @@
@endsection +--> +

Home Page

diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/layouts/errors.blade.php b/resources/views/layouts/errors.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/layouts/footer.blade.php b/resources/views/layouts/footer.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/layouts/nav.blade.php b/resources/views/layouts/nav.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/tasks/create.blade.php b/resources/views/tasks/create.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/tasks/edit.blade.php b/resources/views/tasks/edit.blade.php old mode 100644 new mode 100755 index 8afd978..de7fd47 --- a/resources/views/tasks/edit.blade.php +++ b/resources/views/tasks/edit.blade.php @@ -46,7 +46,7 @@ value="{{ $task->end_date }}" placeholder="YYYY-MM-DD HH:mm">
- Cancel + @include('layouts.errors') diff --git a/resources/views/tasks/index.blade.php b/resources/views/tasks/index.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/tasks/listing.blade.php b/resources/views/tasks/listing.blade.php old mode 100644 new mode 100755 index 6387971..547b505 --- a/resources/views/tasks/listing.blade.php +++ b/resources/views/tasks/listing.blade.php @@ -1,51 +1,21 @@
-
-
-

- {{ $task->title }} -

- -
-
-

Owner: {{$task->first_name}} {{$task->last_name}}

-
-
-

Start Time: {{ $task->start_date }}

-
-
-
-
-

Category: {{ $task->category }}

-
-
-

End Time: {{ $task->end_date }}

-
-
+

{{ $task->title }}

+

Created at: {{ $task->created_at }}

+

Category: {{ $task->category }}

+

Start Time: {{ $task->start_date }}

+

End Time: {{ $task->end_date }}

Description: {{ $task->description }}

- -
- - @if (Auth::check() && ($user->is_admin || $user->id == $task->owner)) -
- Edit -
- -
- {{ Form::open(['method' => 'DELETE', 'route' => ['task.destroy', $task->id]]) }} - {{ Form::submit('Delete', ['class' => 'btn btn-danger']) }} - {{ Form::close() }} -
- @endif -
-
-
-
+ @if (Auth::check() && ($user->is_admin || $user->id == $task->owner)) + Edit + {{ Form::open(['method' => 'DELETE', 'route' => ['task.destroy', $task->id]]) }} + {{ Form::submit('Delete', ['class' => 'btn btn-danger']) }} + {{ Form::close() }} + @endif
+
diff --git a/resources/views/tasks/search.blade.php b/resources/views/tasks/search.blade.php new file mode 100755 index 0000000..0b35ebb --- /dev/null +++ b/resources/views/tasks/search.blade.php @@ -0,0 +1,39 @@ +@extends('layouts.app') + + +@section('content') + +
+ @if(count($details) > 0) +

The Search results for your query {{ $query }} are :

+

Task details

+ + + + + + + + + + + + @foreach($details as $task) + + + + + + + + @endforeach + +
TitleCreated_atCategoryStart_DateEnd_Date
{{$task->title}}{{$task->created_at}}{{$task->category}}{{$task->start_date}}{{$task->end_date}}
+ @else + No results found + @endif +
+ + + +@endsection \ No newline at end of file diff --git a/resources/views/tasks/show.blade.php b/resources/views/tasks/show.blade.php old mode 100644 new mode 100755 index 89b9f0d..3bc8932 --- a/resources/views/tasks/show.blade.php +++ b/resources/views/tasks/show.blade.php @@ -1,13 +1,12 @@ @extends ('layouts.app') @section('content') -
@if ($task->status == 2) - + @elseif ($task->status == 1) @endif @@ -16,43 +15,57 @@
- -

{{ $task->title }}

-
-
-

Owner: {{$taskOwner->first_name}} {{$taskOwner->last_name}}

-

Created at: {{ $task->created_at }}

-

Category: {{ $task->category }}

-

Start Time: {{ $task->start_date }}

-

End Time: {{ $task->end_date }}

-

Description: {{ $task->description }}

-
+
+

{{ $task->title }}

+

Status: + @php + switch($task->status) { + case 0: + print("opened"); + break; + case 1: + print("closed"); + break; + case 2: + print("completed"); + break; + default: + break; + } + @endphp +

+

Created at: {{ $task->created_at }}

+

Category: {{ $task->category }}

+

Start Time: {{ $task->start_date }}

+

End Time: {{ $task->end_date }}

+

Description: {{ $task->description }}

+ @if (Auth::check() && ($user->is_admin || $user->id == $task->owner)) + Edit + {{ Form::open(['method' => 'DELETE', 'route' => ['task.destroy', $task->id]]) }} + {{ Form::submit('Delete', ['class' => 'btn btn-danger']) }} + {{ Form::close() }} + @endif
-
@if ($task->status != 2) +
-

Bids

    - @if(sizeOf($bids) <= 0) -
  • - There are currently no bids for this task. -
  • - @else - @foreach($bids as $bid) + @foreach($task->bids as $bid) @if ($task->status == 0 || $bid->selected == 'true') -
  • - {{ \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $bid->created_at)->diffForHumans()}}:  - {{$bid->first_name}} {{$bid->last_name}} bid ${{ $bid->price }}  - @if ($bid->selected == 'true') - Winning Bid - @endif + @if ($bid->selected == 'true') + Winning Bid + @endif +
  • + + {{ $bid->created_at->diffForHumans() }}:   + + {{$bid->user_id}} ${{ $bid->price }} - @if (Auth::check() && ($user->is_admin || $user->id == $task->owner)) @if ($bid->selected) {{ Form::open(['method' => 'POST', 'route' => ['bid.update', $task->id, $bid->id, 'false']]) }} @@ -70,17 +83,16 @@ {{ Form::submit('Delete', ['class' => 'btn btn-danger']) }} {{ Form::close() }} @endif -
  • @endif @endforeach - @endif
@if (Auth::check() && ($user->is_admin || ($user->id != $task->owner && $task->status == 0))) +
@@ -104,35 +116,18 @@
@endif - + @if (Auth::check() && ($user->is_admin || ($user->id == $task->owner))) -
-
- - @if (Auth::check() && ($user->is_admin || $user->id == $task->owner) && $task->status != 2) - -
- {{ Form::open(['method' => 'DELETE', 'route' => ['task.destroy', $task->id]]) }} - {{ Form::submit('Delete', ['class' => 'btn btn-danger']) }} - {{ Form::close() }} -
+ @if ($task->status != 2) + {{ Form::open(['method' => 'GET', 'route' => ['tasks.updateStatus', $task->id, 2]]) }} + {{ Form::submit('Complete Task', ['class' => 'btn btn-success']) }} + {{ Form::close() }} @endif - - -
- @if ($task->status != 2) - {{ Form::open(['method' => 'GET', 'route' => ['tasks.updateStatus', $task->id, 2]]) }} - {{ Form::submit('Mark Task Completed', ['class' => 'btn btn-success']) }} - {{ Form::close() }} - @endif -
-
@endif @endif -
@endsection diff --git a/resources/views/users/index.blade.php b/resources/views/users/index.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/users/listing.blade.php b/resources/views/users/listing.blade.php old mode 100644 new mode 100755 diff --git a/resources/views/users/show.blade.php b/resources/views/users/show.blade.php old mode 100644 new mode 100755 diff --git a/routes/api.php b/routes/api.php old mode 100644 new mode 100755 diff --git a/routes/channels.php b/routes/channels.php old mode 100644 new mode 100755 index 2bcb553..4d35699 --- a/routes/channels.php +++ b/routes/channels.php @@ -13,4 +13,5 @@ Broadcast::channel('App.User.{id}', function ($user, $id) { return (int)$user->id === (int)$id; + }); diff --git a/routes/console.php b/routes/console.php old mode 100644 new mode 100755 diff --git a/routes/web.php b/routes/web.php old mode 100644 new mode 100755 index b819e99..b115d97 --- a/routes/web.php +++ b/routes/web.php @@ -1,4 +1,4 @@ - 'auth'], function () { + + /* Route::get('/',function(){ + + return "This is Home Page "; + }); + */ +}); + Route::post('/tasks', 'Resources\TasksController@store'); Route::patch('/tasks/{task}', 'Resources\TasksController@update'); Route::delete('/tasks/{task}', 'Resources\TasksController@destroy')->name('task.destroy'); @@ -24,6 +32,11 @@ Route::get('/tasks/{task}/edit', 'Resources\TasksController@edit'); // this should be a post or a patch but Laravel gives a MethodNotAllowed error if it is anything but get Route::get('/tasks/{task}/status/{status}', 'Resources\TasksController@updateStatus')->name('tasks.updateStatus'); + // Route::get('/tasks/search/{query}', ['uses' => 'Resources\TasksController@search', 'as' => 'search']); + + Route::any('/tasks/search','Resources\TasksController@search'); + + Route::post('tasks/{task}/bids/{bid}/{selected}', 'Resources\BidsController@update')->name('bid.update'); Route::post('/tasks/{task}/bids', 'Resources\BidsController@store'); @@ -36,21 +49,27 @@ Route::get('/tasks', 'Resources\TasksController@index'); Route::get('/tasks/{task}', 'Resources\TasksController@show'); + Route::get('/tasks/{task}/bids/{bid}', 'Resources\BidsController@show'); Route::get('/users/{user}', 'Resources\UsersController@show'); Route::get('/users', 'Resources\UsersController@index'); -}); + + /* * Unauthenticated API Routes should be placed here. */ +Auth::routes(); + +Route::get('/', 'HomeController@index'); + + Route::get('test',function(){ + + $user_id = \Illuminate\Support\Facades\Auth::user()->id; -Route::get('/register', 'Auth\RegistrationController@create'); -Route::post('/register', 'Auth\RegistrationController@store')->name('register'); + return \Illuminate\Support\Facades\DB::table('bids')->join('tasks','bids.user_id','=','tasks.owner')->where('bids.user_id',$user_id)->count() ; -Route::get('/login', 'Auth\SessionsController@create'); -Route::post('/login', 'Auth\SessionsController@store')->name('login'); + }); -Route::post('/logout', 'Auth\SessionsController@destroy')->name('logout'); -Route::get('/', 'HomeController@index')->name('home'); + ?> \ No newline at end of file diff --git a/server.php b/server.php old mode 100644 new mode 100755 diff --git a/storage/app/.gitignore b/storage/app/.gitignore old mode 100644 new mode 100755 diff --git a/storage/app/public/.gitignore b/storage/app/public/.gitignore old mode 100644 new mode 100755 diff --git a/storage/framework/.gitignore b/storage/framework/.gitignore old mode 100644 new mode 100755 diff --git a/storage/framework/cache/.gitignore b/storage/framework/cache/.gitignore old mode 100644 new mode 100755 diff --git a/storage/framework/sessions/.gitignore b/storage/framework/sessions/.gitignore old mode 100644 new mode 100755 diff --git a/storage/framework/views/.gitignore b/storage/framework/views/.gitignore old mode 100644 new mode 100755 diff --git a/storage/logs/.gitignore b/storage/logs/.gitignore old mode 100644 new mode 100755 diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php old mode 100644 new mode 100755 diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php old mode 100644 new mode 100755 diff --git a/tests/TestCase.php b/tests/TestCase.php old mode 100644 new mode 100755 diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php old mode 100644 new mode 100755 diff --git a/webpack.mix.js b/webpack.mix.js old mode 100644 new mode 100755 diff --git a/yarn.lock b/yarn.lock old mode 100644 new mode 100755