├── public ├── favicon.ico ├── robots.txt ├── .htaccess ├── web.config └── index.php ├── routes ├── api.php └── web.php ├── app ├── Listeners │ └── .gitkeep ├── Policies │ └── .gitkeep ├── Events │ └── Event.php ├── Http │ ├── Requests │ │ └── Request.php │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── RedirectIfAuthenticated.php │ │ └── Authenticate.php │ ├── Controllers │ │ ├── Controller.php │ │ ├── PagesController.php │ │ ├── Auth │ │ │ ├── PasswordController.php │ │ │ ├── ForgotPasswordController.php │ │ │ ├── AuthController.php │ │ │ ├── RegisterController.php │ │ │ └── LoginController.php │ │ └── SurveysController.php │ └── Kernel.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Jobs │ └── Job.php ├── Console │ ├── Commands │ │ └── Inspire.php │ └── Kernel.php ├── Survey.php ├── User.php └── Exceptions │ └── Handler.php ├── database ├── seeds │ ├── .gitkeep │ └── DatabaseSeeder.php ├── .gitignore ├── migrations │ ├── .gitkeep │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2014_10_12_000000_create_users_table.php │ └── 2016_10_03_133437_create_surveys_table.php └── factories │ └── ModelFactory.php ├── resources ├── lang │ ├── en │ │ ├── globals.php │ │ ├── user.php │ │ ├── pagination.php │ │ ├── auth.php │ │ ├── passwords.php │ │ └── validation.php │ └── mn │ │ ├── globals.php │ │ ├── user.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php └── views │ ├── vendor │ └── .gitkeep │ ├── partial │ └── header.blade.php │ ├── js │ └── main.js │ ├── landing.blade.php │ ├── auth │ ├── emails │ │ └── password.blade.php │ ├── passwords │ │ ├── email.blade.php │ │ └── reset.blade.php │ ├── login.blade.php │ └── register.blade.php │ ├── pages │ ├── dic.blade.php │ ├── index.blade.php │ ├── show.blade.php │ └── new_survey.blade.php │ ├── errors │ └── 503.blade.php │ └── app.blade.php ├── bootstrap ├── cache │ └── .gitignore ├── autoload.php └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore ├── framework │ ├── cache │ │ └── .gitignore │ ├── views │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── .gitignore └── database.sqlite ├── .gitattributes ├── .gitignore ├── .htaccess ├── readme.md ├── package.json ├── .env.example ├── gulpfile.js ├── tests ├── TestCase.php ├── PagesControllerTest.php ├── SurveyTest.php ├── UserTest.php └── SurveysControllerTest.php ├── server.php ├── config ├── compile.php ├── services.php ├── view.php ├── broadcasting.php ├── filesystems.php ├── cache.php ├── queue.php ├── auth.php ├── database.php ├── mail.php ├── session.php └── app.php ├── LICENSE ├── phpunit.xml ├── composer.json └── artisan /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Listeners/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/Policies/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/lang/en/globals.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/views/partial/header.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /resources/views/js/main.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | -------------------------------------------------------------------------------- /storage/database.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tortuvshin/devtools/HEAD/storage/database.sqlite -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | /node_modules 3 | /public/storage 4 | Homestead.yaml 5 | Homestead.json 6 | .env 7 | -------------------------------------------------------------------------------- /.htaccess: -------------------------------------------------------------------------------- 1 | 2 | RewriteEngine On 3 | RewriteRule ^(.*)$ public/$1 [L] 4 | -------------------------------------------------------------------------------- /app/Events/Event.php: -------------------------------------------------------------------------------- 1 | 'Register', 6 | 'login' => 'Login', 7 | 8 | ]; 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /resources/views/landing.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |

Сайн уу

6 |

Нэвтэр бүртгүүл

7 |
8 | @endsection 9 | -------------------------------------------------------------------------------- /app/Http/Requests/Request.php: -------------------------------------------------------------------------------- 1 | getEmailForPasswordReset()) }}"> {{ $link }} 2 | -------------------------------------------------------------------------------- /resources/lang/mn/globals.php: -------------------------------------------------------------------------------- 1 | 'Шаардлага цуглуулагч', 6 | 'home_page' => 'Нүүр хуудас', 7 | 'new_survey' => 'Шаардлага бөглөх', 8 | 'your_average' => 'Таны дундаж', 9 | 'submit' => 'Батлах', 10 | 11 | ]; 12 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Шаардлага цуглуулагч 2 | 3 | ## Эхлэл 4 | 5 | Шаардлага: Та [Composer](https://getcomposer.org/) суулгасан байх шаардлагатай. 6 | 7 | Дараа нь энэхүү төслийн татаж авна: 8 | - `composer install` 9 | - `php artisan key:generate` 10 | 11 | ## Ажиллуулах 12 | 13 | `php -S localhost:8888 -t public` харах `localhost:8888`. 14 | 15 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 'Бүртгүүлэх', 6 | 'login' => 'Нэвтрэх', 7 | 'logout' => 'Гарах', 8 | 'password_reset_message'=> 'Нууц үгээ шинэчлэх бол энд дар', 9 | 'reset_password' => 'Нууц үг шинэчлэх', 10 | 'email' => 'Мэйл хаяг', 11 | 'password' => 'Нууц үг', 12 | 'confirm_password' => 'Нууц үг давт', 13 | 'send_password_link' => 'Нууц үг илгээх холбоос', 14 | 'forgot_password' => 'Нууц үг мартсан', 15 | 'remember_me' => 'Намайг сана', 16 | 'name' => 'Нэр', 17 | 'logout' => 'Гарах', 18 | ]; 19 | -------------------------------------------------------------------------------- /app/Jobs/Job.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/mn/pagination.php: -------------------------------------------------------------------------------- 1 | '« Өмнөх', 17 | 'next' => 'Дараах »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes If Not A Folder... 9 | RewriteCond %{REQUEST_FILENAME} !-d 10 | RewriteRule ^(.*)/$ /$1 [L,R=301] 11 | 12 | # Handle Front Controller... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteRule ^ index.php [L] 16 | 17 | # Handle Authorization Header 18 | RewriteCond %{HTTP:Authorization} . 19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 20 | 21 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); 22 | 23 | return $app; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /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('/'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /database/factories/ModelFactory.php: -------------------------------------------------------------------------------- 1 | define(App\User::class, function (Faker\Generator $faker) { 15 | return [ 16 | 'name' => $faker->name, 17 | 'email' => $faker->safeEmail, 18 | 'password' => bcrypt(str_random(10)), 19 | 'remember_token' => str_random(10), 20 | ]; 21 | }); 22 | -------------------------------------------------------------------------------- /app/Console/Commands/Inspire.php: -------------------------------------------------------------------------------- 1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | guest()) { 21 | if ($request->ajax() || $request->wantsJson()) { 22 | return response('Unauthorized.', 401); 23 | } else { 24 | return redirect()->guest('login'); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 17 | $table->string('token')->index(); 18 | $table->timestamp('created_at'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::drop('password_resets'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any application authentication / authorization services. 21 | * 22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate 23 | * @return void 24 | */ 25 | public function boot(GateContract $gate) 26 | { 27 | $this->registerPolicies($gate); 28 | 29 | // 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any other events for your application. 23 | * 24 | * @param \Illuminate\Contracts\Events\Dispatcher $events 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Http/Controllers/PagesController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 15 | } 16 | 17 | public function index() 18 | { 19 | return view('pages.index'); 20 | } 21 | 22 | public function newSurvey() 23 | { 24 | return view('pages.new_survey'); 25 | } 26 | 27 | public function dictionary() 28 | { 29 | return view('pages.dic'); 30 | } 31 | 32 | public function show($id) 33 | { 34 | $survey = Survey::find($id); 35 | if($survey->user != \Auth::user()){ 36 | return redirect()->action('PagesController@index'); 37 | }; 38 | 39 | return view('pages.show'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->string('email')->unique(); 19 | $table->string('password'); 20 | $table->rememberToken(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::drop('users'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /resources/lang/mn/passwords.php: -------------------------------------------------------------------------------- 1 | 'Нууц үг хамгийн багадаа 6-н тэмдэгтийн урттай байх бөгөөд баталгаажуулттай ижил байх ёстой.', 16 | 'reset' => 'Таний нууц үг шинэчлэгдсэн!', 17 | 'sent' => 'Нууц үг сэргээх холбоосийг таний и-мэйл хаяг уруу явуулсан!', 18 | 'token' => 'Алдаатай нууц үг сэргээх холбоос.', 19 | 'user' => "Ийм и-мэйл хаягтай хэрэглэгч олдсонгүй.", 20 | ]; 21 | 22 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/PasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | visit('/') 16 | ->see('Welcome to Daily Mood Survey'); 17 | } 18 | 19 | public function testCannotVisitSurveysPage() 20 | { 21 | $this->visit('/daily-surveys') 22 | ->dontsee('Log Out') 23 | ->see('Forgot Your Password?'); 24 | } 25 | 26 | public function testCanVisitSurveysPage($value='') 27 | { 28 | $faker = Faker::create(); 29 | $user = User::create(['name'=>str_random(20), 'email'=>$faker->email,'password'=>'password']); 30 | $this->be($user); 31 | 32 | $this->visit('/daily-surveys') 33 | ->see('Your Averages') 34 | ->see('Log Out'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Survey.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\User'); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /config/compile.php: -------------------------------------------------------------------------------- 1 | [ 17 | // 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled File Providers 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may list service providers which define a "compiles" function 26 | | that returns additional files that should be compiled, providing an 27 | | easy way to get common files from any packages you are utilizing. 28 | | 29 | */ 30 | 31 | 'providers' => [ 32 | // 33 | ], 34 | 35 | ]; 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Tortuvshin Byambaa 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 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests 14 | 15 | 16 | 17 | 18 | ./app 19 | 20 | ./app/Http/routes.php 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /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' => '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 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | realpath(base_path('resources/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 | -------------------------------------------------------------------------------- /resources/views/pages/dic.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 | 7 | 8 | 43 | @endsection 44 | -------------------------------------------------------------------------------- /database/migrations/2016_10_03_133437_create_surveys_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->integer('user_id')->unsigned(); 18 | $table->integer('question_1_response'); 19 | $table->integer('question_2_response'); 20 | $table->integer('question_3_response'); 21 | $table->integer('question_4_response'); 22 | $table->timestamp('time_taken'); 23 | $table->timestamps(); 24 | 25 | $table->foreign('user_id') 26 | ->references('id') 27 | ->on('users') 28 | ->onDelete('cascade'); 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::drop('surveys'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 30 | } 31 | 32 | /** 33 | * Show the recover password form. 34 | * 35 | * @return void 36 | */ 37 | public function showLinkRequestForm() 38 | { 39 | return view('auth.passwords.email'); 40 | } 41 | } -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Be right back. 5 | 6 | 7 | 8 | 39 | 40 | 41 |
42 |
43 |
Be right back.
44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | surveys()->select( 36 | DB::raw( 37 | 'avg(question_1_response) question_1_response, 38 | avg(question_2_response) question_2_response, 39 | avg(question_3_response) question_3_response, 40 | avg(question_4_response) question_4_response' 41 | ))->first(); 42 | return $averages; 43 | } 44 | 45 | /** 46 | * Returns the surveys belonging to user 47 | * 48 | * @return collection 49 | */ 50 | public function surveys() 51 | { 52 | return $this->hasMany('App\Survey'); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/SurveyTest.php: -------------------------------------------------------------------------------- 1 | assertEquals('How happy are you feeling today?', $survey->questionOneContent()); 19 | $this->assertEquals('How well did you sleep last night?', $survey->questionTwoContent()); 20 | $this->assertEquals('How likely are you to see a friend today?', $survey->questionThreeContent()); 21 | $this->assertEquals('How pleased are your with your diet today?', $survey->questionFourContent()); 22 | } 23 | 24 | public function testSurveyBelongsToUser() 25 | { 26 | $faker = Faker::create(); 27 | $user = User::create(['name'=>str_random(20), 'email'=>$faker->email,'password'=>'password']); 28 | $survey = Survey::create(['user_id'=> $user->id, 'question_1_response' => 1, 'question_2_response' => 2, 'question_3_response' => 3, 'question_4_response' => 4,'time_taken'=> Carbon::now()]); 29 | 30 | $results = $survey->user->toArray(); 31 | 32 | $this->assertEquals($user->toArray(), $results); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /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": ">=5.6.4", 9 | "laravel/framework": "5.3.*", 10 | "laravelcollective/html": "^5.3", 11 | "doctrine/dbal": "^2.5" 12 | }, 13 | "require-dev": { 14 | "fzaninotto/faker": "~1.5", 15 | "mockery/mockery": "0.9.*", 16 | "phpunit/phpunit": "~4.0", 17 | "symfony/css-selector": "~3.0", 18 | "symfony/dom-crawler": "~3.0" 19 | }, 20 | "autoload": { 21 | "classmap": [ 22 | "database" 23 | ], 24 | "psr-4": { 25 | "App\\": "app/" 26 | } 27 | }, 28 | "autoload-dev": { 29 | "classmap": [ 30 | "tests/TestCase.php" 31 | ] 32 | }, 33 | "scripts": { 34 | "post-root-package-install": [ 35 | "php -r \"copy('.env.example', '.env');\"" 36 | ], 37 | "post-create-project-cmd": [ 38 | "php artisan key:generate" 39 | ], 40 | "post-install-cmd": [ 41 | "Illuminate\\Foundation\\ComposerScripts::postInstall", 42 | "php artisan optimize" 43 | ], 44 | "post-update-cmd": [ 45 | "Illuminate\\Foundation\\ComposerScripts::postUpdate", 46 | "php artisan optimize" 47 | ] 48 | }, 49 | "config": { 50 | "preferred-install": "dist" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'pusher'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Broadcast Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may define all of the broadcast connections that will be used 24 | | to broadcast events to other systems or over websockets. Samples of 25 | | each available type of connection are provided inside this array. 26 | | 27 | */ 28 | 29 | 'connections' => [ 30 | 31 | 'pusher' => [ 32 | 'driver' => 'pusher', 33 | 'key' => env('PUSHER_KEY'), 34 | 'secret' => env('PUSHER_SECRET'), 35 | 'app_id' => env('PUSHER_APP_ID'), 36 | 'options' => [ 37 | // 38 | ], 39 | ], 40 | 41 | 'redis' => [ 42 | 'driver' => 'redis', 43 | 'connection' => 'default', 44 | ], 45 | 46 | 'log' => [ 47 | 'driver' => 'log', 48 | ], 49 | 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /app/Http/Controllers/SurveysController.php: -------------------------------------------------------------------------------- 1 | getSurveyAverages(); 21 | 22 | return $surveyAverages; 23 | } 24 | 25 | /** 26 | * Instantiates a new survey to programmatically pass survey questions to Javascript 27 | * 28 | */ 29 | public function newSurvey() 30 | { 31 | $survey = new Survey(); 32 | $survey['question_1'] = $survey->questionOneContent(); 33 | $survey['question_2'] = $survey->questionTwoContent(); 34 | $survey['question_3'] = $survey->questionThreeContent(); 35 | $survey['question_4'] = $survey->questionFourContent(); 36 | 37 | return $survey; 38 | } 39 | 40 | /** 41 | * Takes form input to create new survey for current user 42 | * 43 | */ 44 | public function create() 45 | { 46 | $input = Request::all(); 47 | $input['user_id'] = \Auth::user()->id; 48 | $input['time_taken'] = Carbon::now(); 49 | 50 | $survey = Survey::create($input); 51 | 52 | return $survey; 53 | } 54 | 55 | /** 56 | * Retreives the current user's survey based on id 57 | * 58 | */ 59 | public function show($id) 60 | { 61 | $survey = Survey::find($id); 62 | 63 | return $survey; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 32 | 33 | $status = $kernel->handle( 34 | $input = new Symfony\Component\Console\Input\ArgvInput, 35 | new Symfony\Component\Console\Output\ConsoleOutput 36 | ); 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Shutdown The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once Artisan has finished running. We will fire off the shutdown events 44 | | so that any final work may be done by the application before we shut 45 | | down the process. This is the last thing to happen to the request. 46 | | 47 | */ 48 | 49 | $kernel->terminate($input, $status); 50 | 51 | exit($status); 52 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | /* 11 | |-------------------------------------------------------------------------- 12 | | Register The Auto Loader 13 | |-------------------------------------------------------------------------- 14 | | 15 | | Composer provides a convenient, automatically generated class loader for 16 | | our application. We just need to utilize it! We'll simply require it 17 | | into the script here so that we don't have to worry about manual 18 | | loading any of our classes later on. It feels nice to relax. 19 | | 20 | */ 21 | 22 | require __DIR__.'/../bootstrap/autoload.php'; 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Turn On The Lights 27 | |-------------------------------------------------------------------------- 28 | | 29 | | We need to illuminate PHP development, so let us turn on the lights. 30 | | This bootstraps the framework and gets it ready for use, then it 31 | | will load up this application so that we can run it and send 32 | | the responses back to the browser and delight our users. 33 | | 34 | */ 35 | 36 | $app = require_once __DIR__.'/../bootstrap/app.php'; 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Run The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once we have the application, we can handle the incoming request 44 | | through the kernel, and send the associated response back to 45 | | the client's browser allowing them to enjoy the creative 46 | | and wonderful application we have prepared for them. 47 | | 48 | */ 49 | 50 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 51 | 52 | $response = $kernel->handle( 53 | $request = Illuminate\Http\Request::capture() 54 | ); 55 | 56 | $response->send(); 57 | 58 | $kernel->terminate($request, $response); 59 | -------------------------------------------------------------------------------- /tests/UserTest.php: -------------------------------------------------------------------------------- 1 | str_random(20), 'email'=>$faker->email,'password'=>'password']); 18 | $survey = Survey::create(['user_id'=> $user->id, 'question_1_response' => 1, 'question_2_response' => 2, 'question_3_response' => 3, 'question_4_response' => 4,'time_taken'=> Carbon::now()]); 19 | 20 | $results = $user->surveys; 21 | 22 | $this->assertCount(1, $results); 23 | } 24 | 25 | public function testUserHasAverageSurvey($value='') 26 | { 27 | $faker = Faker::create(); 28 | $user = User::create(['name'=>str_random(20), 'email'=>$faker->email,'password'=>'password']); 29 | $survey1 = Survey::create(['user_id'=> $user->id, 'question_1_response' => 1, 'question_2_response' => 2, 'question_3_response' => 3, 'question_4_response' => 4,'time_taken'=> Carbon::now()]); 30 | $survey2 = Survey::create(['user_id'=> $user->id, 'question_1_response' => 1, 'question_2_response' => 2, 'question_3_response' => 3, 'question_4_response' => 4,'time_taken'=> Carbon::now()]); 31 | $survey3 = Survey::create(['user_id'=> $user->id, 'question_1_response' => 1, 'question_2_response' => 2, 'question_3_response' => 3, 'question_4_response' => 4,'time_taken'=> Carbon::now()]); 32 | 33 | $expectedResults = ['question_1_response' => '1.0', 34 | 'question_2_response' => '2.0', 35 | 'question_3_response' => '3.0', 36 | 'question_4_response' => '4.0']; 37 | 38 | $this->assertEquals($expectedResults, $user->getSurveyAverages()->toArray()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 62 | return response()->json(['error' => 'Unauthenticated.'], 401); 63 | } 64 | 65 | return redirect()->guest('login'); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /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\View\Middleware\ShareErrorsFromSession::class, 36 | \App\Http\Middleware\VerifyCsrfToken::class, 37 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 38 | ], 39 | 'api' => [ 40 | 'throttle:60,1', 41 | 'bindings', 42 | ], 43 | ]; 44 | 45 | /** 46 | * The application's route middleware. 47 | * 48 | * These middleware may be assigned to groups or used individually. 49 | * 50 | * @var array 51 | */ 52 | protected $routeMiddleware = [ 53 | 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 54 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 55 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 56 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 57 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 58 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 59 | 'roles' => \App\Http\Middleware\CheckRole::class, 60 | ]; 61 | } 62 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapWebRoutes(); 41 | $this->mapApiRoutes(); 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::group([ 55 | 'middleware' => 'web', 56 | 'namespace' => $this->namespace, 57 | ], function ($router) { 58 | require base_path('routes/web.php'); 59 | }); 60 | } 61 | 62 | /** 63 | * Define the "api" routes for the application. 64 | * 65 | * These routes are typically stateless. 66 | * 67 | * @return void 68 | */ 69 | protected function mapApiRoutes() 70 | { 71 | Route::group([ 72 | 'middleware' => 'api', 73 | 'namespace' => $this->namespace, 74 | 'prefix' => 'api', 75 | ], function ($router) { 76 | require base_path('routes/api.php'); 77 | }); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | 4 | @section('content') 5 |
6 |
7 |
8 |
9 |
{{trans('user.reset_password')}}
10 |
11 | @if (session('status')) 12 |
13 | {{ session('status') }} 14 |
15 | @endif 16 | 17 |
18 | {{ csrf_field() }} 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 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | 'local', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Default Cloud Filesystem Disk 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Many applications store files both locally and in the cloud. For this 26 | | reason, you may specify a default "cloud" driver here. This driver 27 | | will be bound as the Cloud disk implementation in the container. 28 | | 29 | */ 30 | 31 | 'cloud' => 's3', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Filesystem Disks 36 | |-------------------------------------------------------------------------- 37 | | 38 | | Here you may configure as many filesystem "disks" as you wish, and you 39 | | may even configure multiple disks of the same driver. Defaults have 40 | | been setup for each driver as an example of the required options. 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 | 'visibility' => 'public', 55 | ], 56 | 57 | 's3' => [ 58 | 'driver' => 's3', 59 | 'key' => 'your-key', 60 | 'secret' => 'your-secret', 61 | 'region' => 'your-region', 62 | 'bucket' => 'your-bucket', 63 | ], 64 | 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/AuthController.php: -------------------------------------------------------------------------------- 1 | middleware($this->guestMiddleware(), ['except' => 'logout']); 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 | 'name' => 'required|max:255', 53 | 'email' => 'required|email|max:255|unique:users', 54 | 'password' => 'required|min:6|confirmed', 55 | ]); 56 | } 57 | 58 | /** 59 | * Create a new user instance after a valid registration. 60 | * 61 | * @param array $data 62 | * @return User 63 | */ 64 | protected function create(array $data) 65 | { 66 | return User::create([ 67 | 'name' => $data['name'], 68 | 'email' => $data['email'], 69 | 'password' => bcrypt($data['password']), 70 | ]); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /tests/SurveysControllerTest.php: -------------------------------------------------------------------------------- 1 | str_random(20), 'email'=>$faker->email,'password'=>'password']); 19 | $this->be($user); 20 | 21 | $survey1 = Survey::create(['user_id'=> $user->id, 'question_1_response' => 1, 'question_2_response' => 2, 'question_3_response' => 3, 'question_4_response' => 4,'time_taken'=> Carbon::now()]); 22 | 23 | $this->get("surveys/{$survey1->id}") 24 | ->seeJson(['id' => $survey1->id]); 25 | } 26 | 27 | public function testCanGetSurveyIndex() 28 | { 29 | $faker = Faker::create(); 30 | $user = User::create(['name'=>str_random(20), 'email'=>$faker->email,'password'=>'password']); 31 | $this->be($user); 32 | 33 | $survey1 = Survey::create(['user_id'=> $user->id, 'question_1_response' => 1, 'question_2_response' => 2, 'question_3_response' => 3, 'question_4_response' => 4,'time_taken'=> Carbon::now()]); 34 | $survey2 = Survey::create(['user_id'=> $user->id, 'question_1_response' => 1, 'question_2_response' => 2, 'question_3_response' => 3, 'question_4_response' => 4,'time_taken'=> Carbon::now()]); 35 | $survey3 = Survey::create(['user_id'=> $user->id, 'question_1_response' => 1, 'question_2_response' => 2, 'question_3_response' => 3, 'question_4_response' => 4,'time_taken'=> Carbon::now()]); 36 | 37 | $expectedResults = ['question_1_response' => '1.0', 38 | 'question_2_response' => '2.0', 39 | 'question_3_response' => '3.0', 40 | 'question_4_response' => '4.0']; 41 | 42 | $this->get("surveys") 43 | ->seeJson($expectedResults); 44 | } 45 | 46 | public function testCanGetSurveynew() 47 | { 48 | $faker = Faker::create(); 49 | $user = User::create(['name'=>str_random(20), 'email'=>$faker->email,'password'=>'password']); 50 | $this->be($user); 51 | 52 | $this->get("surveys/new") 53 | ->seeJson(["question_1" => "How happy are you feeling today?"]); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Cache Stores 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may define all of the cache "stores" for your application as 24 | | well as their drivers. You may even define multiple stores for the 25 | | same cache driver to group types of items stored in your caches. 26 | | 27 | */ 28 | 29 | 'stores' => [ 30 | 31 | 'apc' => [ 32 | 'driver' => 'apc', 33 | ], 34 | 35 | 'array' => [ 36 | 'driver' => 'array', 37 | ], 38 | 39 | 'database' => [ 40 | 'driver' => 'database', 41 | 'table' => 'cache', 42 | 'connection' => null, 43 | ], 44 | 45 | 'file' => [ 46 | 'driver' => 'file', 47 | 'path' => storage_path('framework/cache'), 48 | ], 49 | 50 | 'memcached' => [ 51 | 'driver' => 'memcached', 52 | 'servers' => [ 53 | [ 54 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 55 | 'port' => env('MEMCACHED_PORT', 11211), 56 | 'weight' => 100, 57 | ], 58 | ], 59 | ], 60 | 61 | 'redis' => [ 62 | 'driver' => 'redis', 63 | 'connection' => 'default', 64 | ], 65 | 66 | ], 67 | 68 | /* 69 | |-------------------------------------------------------------------------- 70 | | Cache Key Prefix 71 | |-------------------------------------------------------------------------- 72 | | 73 | | When utilizing a RAM based store such as APC or Memcached, there might 74 | | be other applications utilizing the same cache. So, we'll specify a 75 | | value to get prefixed to all our keys so we can avoid collisions. 76 | | 77 | */ 78 | 79 | 'prefix' => 'laravel', 80 | 81 | ]; 82 | -------------------------------------------------------------------------------- /resources/views/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{trans('globals.site_title')}} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 47 |
48 |
49 | @yield('content') 50 |
51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_DRIVER', 'sync'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 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 | 'expire' => 60, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'ttr' => 60, 49 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => 'your-public-key', 54 | 'secret' => 'your-secret-key', 55 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', 56 | 'queue' => 'your-queue-name', 57 | 'region' => 'us-east-1', 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => 'default', 64 | 'expire' => 60, 65 | ], 66 | 67 | ], 68 | 69 | /* 70 | |-------------------------------------------------------------------------- 71 | | Failed Queue Jobs 72 | |-------------------------------------------------------------------------- 73 | | 74 | | These options configure the behavior of failed queue job logging so you 75 | | can control which database and table are used to store the jobs that 76 | | have failed. You may change them to any database / table you wish. 77 | | 78 | */ 79 | 80 | 'failed' => [ 81 | 'database' => env('DB_CONNECTION', 'mysql'), 82 | 'table' => 'failed_jobs', 83 | ], 84 | 85 | ]; 86 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 40 | } 41 | 42 | /** 43 | * Show the registration form. 44 | * 45 | * @return void 46 | */ 47 | protected function showRegistrationForm() 48 | { 49 | return view('auth.register', [ 50 | 'email' => session()->has('email') ? session()->get('email') : '' 51 | ]); 52 | } 53 | 54 | /** 55 | * Process the user registration. 56 | * 57 | * @return void 58 | */ 59 | protected function register(Request $request) 60 | { 61 | $this->validate($request, $this->rules()); 62 | 63 | $user = $this->createUser($request->all()); 64 | 65 | auth()->login($user); 66 | 67 | return redirect($this->redirectTo); 68 | } 69 | 70 | /** 71 | * Return the registration validation rules 72 | * 73 | * @return array 74 | */ 75 | protected function rules() 76 | { 77 | return [ 78 | 'name' => 'required|max:255', 79 | 'email' => 'required|email|max:255|unique:users', 80 | 'password' => 'required|min:6|confirmed', 81 | ]; 82 | } 83 | 84 | /** 85 | * Create a new user. 86 | * 87 | * @param array $data 88 | * @return User 89 | */ 90 | protected function createUser(array $data) 91 | { 92 | $user = User::create([ 93 | 'name' => $data['name'], 94 | 'email' => $data['email'], 95 | 'password' => bcrypt($data['password']), 96 | ]); 97 | 98 | return $user; 99 | } 100 | 101 | } -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest', ['except' => 'logout']); 39 | } 40 | 41 | /** 42 | * Process the user login. 43 | * 44 | * @param Request $request 45 | * @return void 46 | */ 47 | public function login(Request $request) 48 | { 49 | if ($request->input('newuser')) { 50 | session()->flash('email', $request->input('email')); 51 | 52 | return redirect('/register'); 53 | } 54 | 55 | return $this->handle($request); 56 | } 57 | 58 | /** 59 | * Handle the user login. 60 | * 61 | * @param Request $request 62 | * @return void 63 | */ 64 | protected function handle(Request $request) 65 | { 66 | $this->validate($request, $this->rules()); 67 | 68 | if (auth()->attempt($this->credentials($request), $request->has('remember'))) { 69 | return redirect($this->redirectTo); 70 | } 71 | 72 | return redirect('/login') 73 | ->withInput($request->only('email', 'remember')) 74 | ->withErrors([ 75 | 'email' => $this->getFailedLoginMessage(), 76 | ]); 77 | } 78 | 79 | /** 80 | * Return the login validation rules. 81 | * 82 | * @return array 83 | */ 84 | protected function rules() 85 | { 86 | $rules = [ 87 | 'email' => 'required|email', 88 | 'password' => 'required', 89 | ]; 90 | 91 | return $rules; 92 | } 93 | 94 | /** 95 | * Return the user credentials. 96 | * 97 | * @param Request $request 98 | * @return array 99 | */ 100 | protected function credentials(Request $request) 101 | { 102 | return [ 103 | 'email' => $request->email, 104 | 'password' => $request->password 105 | ]; 106 | } 107 | } -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{trans('user.login')}}
9 |
10 |
11 | {{ csrf_field() }} 12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 | @if ($errors->has('email')) 20 | 21 | {{ $errors->first('email') }} 22 | 23 | @endif 24 |
25 |
26 | 27 |
28 | 29 | 30 |
31 | 32 | 33 | @if ($errors->has('password')) 34 | 35 | {{ $errors->first('password') }} 36 | 37 | @endif 38 |
39 |
40 | 41 |
42 |
43 |
44 | 47 |
48 |
49 |
50 | 51 |
52 |
53 | 56 | 57 | {{trans('user.forgot_password')}}? 58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | @endsection 67 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{trans('user.reset_password')}}
9 | 10 |
11 |
12 | {{ csrf_field() }} 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 | @if ($errors->has('password_confirmation')) 50 | 51 | {{ $errors->first('password_confirmation') }} 52 | 53 | @endif 54 |
55 |
56 | 57 |
58 |
59 | 62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | @endsection 71 | -------------------------------------------------------------------------------- /resources/views/pages/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 | 7 | 115 | @endsection 116 | -------------------------------------------------------------------------------- /resources/views/pages/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 | 7 | 117 | @endsection 118 | -------------------------------------------------------------------------------- /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 | | Here you may set the options for resetting passwords including the view 85 | | that is your password reset e-mail. You may also set the name of the 86 | | table that maintains all of the reset tokens for your application. 87 | | 88 | | You may specify multiple password reset configurations if you have more 89 | | than one user table or model in the application and you want to have 90 | | separate password reset settings based on the specific user types. 91 | | 92 | | The expire time is the number of minutes that the reset token should be 93 | | considered valid. This security feature keeps tokens short-lived so 94 | | they have less time to be guessed. You may change this as needed. 95 | | 96 | */ 97 | 98 | 'passwords' => [ 99 | 'users' => [ 100 | 'provider' => 'users', 101 | 'email' => 'auth.emails.password', 102 | 'table' => 'password_resets', 103 | 'expire' => 60, 104 | ], 105 | ], 106 | 107 | ]; 108 | -------------------------------------------------------------------------------- /resources/views/auth/register.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{trans('user.register')}}
9 |
10 |
11 | {{ csrf_field() }} 12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 | @if ($errors->has('name')) 20 | 21 | {{ $errors->first('name') }} 22 | 23 | @endif 24 |
25 |
26 | 27 |
28 | 29 | 30 |
31 | 32 | 33 | @if ($errors->has('email')) 34 | 35 | {{ $errors->first('email') }} 36 | 37 | @endif 38 |
39 |
40 | 41 |
42 | 43 | 44 |
45 | 46 | 47 | @if ($errors->has('password')) 48 | 49 | {{ $errors->first('password') }} 50 | 51 | @endif 52 |
53 |
54 | 55 |
56 | 57 | 58 |
59 | 60 | 61 | @if ($errors->has('password_confirmation')) 62 | 63 | {{ $errors->first('password_confirmation') }} 64 | 65 | @endif 66 |
67 |
68 | 69 |
70 |
71 | 74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | @endsection 83 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | PDO::FETCH_CLASS, 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Database Connection Name 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may specify which of the database connections below you wish 24 | | to use as your default connection for all database work. Of course 25 | | you may use many connections at once using the Database library. 26 | | 27 | */ 28 | 29 | 'default' => env('DB_CONNECTION', 'sqlite'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Database Connections 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here are each of the database connections setup for your application. 37 | | Of course, examples of configuring each database platform that is 38 | | supported by Laravel is shown below to make development simple. 39 | | 40 | | 41 | | All database work in Laravel is done through the PHP PDO facilities 42 | | so make sure you have the driver for your particular database of 43 | | choice installed on your machine before you begin development. 44 | | 45 | */ 46 | 47 | 'connections' => [ 48 | 49 | 'sqlite' => [ 50 | 'driver' => 'sqlite', 51 | 'database' => storage_path('database.sqlite'), 52 | 'prefix' => '', 53 | ], 54 | 55 | 'mysql' => [ 56 | 'driver' => 'mysql', 57 | 'host' => env('DB_HOST', 'localhost'), 58 | 'port' => env('DB_PORT', '3306'), 59 | 'database' => env('DB_DATABASE', 'forge'), 60 | 'username' => env('DB_USERNAME', 'forge'), 61 | 'password' => env('DB_PASSWORD', ''), 62 | 'charset' => 'utf8', 63 | 'collation' => 'utf8_unicode_ci', 64 | 'prefix' => '', 65 | 'strict' => false, 66 | 'engine' => null, 67 | ], 68 | 69 | 'pgsql' => [ 70 | 'driver' => 'pgsql', 71 | 'host' => env('DB_HOST', 'localhost'), 72 | 'port' => env('DB_PORT', '5432'), 73 | 'database' => env('DB_DATABASE', 'forge'), 74 | 'username' => env('DB_USERNAME', 'forge'), 75 | 'password' => env('DB_PASSWORD', ''), 76 | 'charset' => 'utf8', 77 | 'prefix' => '', 78 | 'schema' => 'public', 79 | ], 80 | 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Migration Repository Table 86 | |-------------------------------------------------------------------------- 87 | | 88 | | This table keeps track of all the migrations that have already run for 89 | | your application. Using this information, we can determine which of 90 | | the migrations on disk haven't actually been run in the database. 91 | | 92 | */ 93 | 94 | 'migrations' => 'migrations', 95 | 96 | /* 97 | |-------------------------------------------------------------------------- 98 | | Redis Databases 99 | |-------------------------------------------------------------------------- 100 | | 101 | | Redis is an open source, fast, and advanced key-value store that also 102 | | provides a richer set of commands than a typical key-value systems 103 | | such as APC or Memcached. Laravel makes it easy to dig right in. 104 | | 105 | */ 106 | 107 | 'redis' => [ 108 | 109 | 'cluster' => false, 110 | 111 | 'default' => [ 112 | 'host' => env('REDIS_HOST', 'localhost'), 113 | 'password' => env('REDIS_PASSWORD', null), 114 | 'port' => env('REDIS_PORT', 6379), 115 | 'database' => 0, 116 | ], 117 | 118 | ], 119 | 120 | ]; 121 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | SMTP Host Address 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may provide the host address of the SMTP server used by your 27 | | applications. A default option is provided that is compatible with 28 | | the Mailgun mail service which will provide reliable deliveries. 29 | | 30 | */ 31 | 32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | SMTP Host Port 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the SMTP port used by your application to deliver e-mails to 40 | | users of the application. Like the host we have set this value to 41 | | stay compatible with the Mailgun e-mail application by default. 42 | | 43 | */ 44 | 45 | 'port' => env('MAIL_PORT', 587), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Global "From" Address 50 | |-------------------------------------------------------------------------- 51 | | 52 | | You may wish for all e-mails sent by your application to be sent from 53 | | the same address. Here, you may specify a name and address that is 54 | | used globally for all e-mails that are sent by your application. 55 | | 56 | */ 57 | 58 | 'from' => ['address' => null, 'name' => null], 59 | 60 | /* 61 | |-------------------------------------------------------------------------- 62 | | E-Mail Encryption Protocol 63 | |-------------------------------------------------------------------------- 64 | | 65 | | Here you may specify the encryption protocol that should be used when 66 | | the application send e-mail messages. A sensible default using the 67 | | transport layer security protocol should provide great security. 68 | | 69 | */ 70 | 71 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 72 | 73 | /* 74 | |-------------------------------------------------------------------------- 75 | | SMTP Server Username 76 | |-------------------------------------------------------------------------- 77 | | 78 | | If your SMTP server requires a username for authentication, you should 79 | | set it here. This will get used to authenticate with your server on 80 | | connection. You may also set the "password" value below this one. 81 | | 82 | */ 83 | 84 | 'username' => env('MAIL_USERNAME'), 85 | 86 | /* 87 | |-------------------------------------------------------------------------- 88 | | SMTP Server Password 89 | |-------------------------------------------------------------------------- 90 | | 91 | | Here you may set the password required by your SMTP server to send out 92 | | messages from your application. This will be given to the server on 93 | | connection so that the application will be able to send messages. 94 | | 95 | */ 96 | 97 | 'password' => env('MAIL_PASSWORD'), 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Sendmail System Path 102 | |-------------------------------------------------------------------------- 103 | | 104 | | When using the "sendmail" driver to send e-mails, we will need to know 105 | | the path to where Sendmail lives on this server. A default path has 106 | | been provided here, which will work well on most of your systems. 107 | | 108 | */ 109 | 110 | 'sendmail' => '/usr/sbin/sendmail -bs', 111 | 112 | ]; 113 | -------------------------------------------------------------------------------- /resources/views/pages/new_survey.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 | 7 | 8 | 139 | @endsection 140 | -------------------------------------------------------------------------------- /resources/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | 'The :attribute must be accepted.', 17 | 'active_url' => 'The :attribute is not a valid URL.', 18 | 'after' => 'The :attribute must be a date after :date.', 19 | 'alpha' => 'The :attribute may only contain letters.', 20 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', 21 | 'alpha_num' => 'The :attribute may only contain letters and numbers.', 22 | 'array' => 'The :attribute must be an array.', 23 | 'before' => 'The :attribute must be a date before :date.', 24 | 'between' => [ 25 | 'numeric' => 'The :attribute must be between :min and :max.', 26 | 'file' => 'The :attribute must be between :min and :max kilobytes.', 27 | 'string' => 'The :attribute must be between :min and :max characters.', 28 | 'array' => 'The :attribute must have between :min and :max items.', 29 | ], 30 | 'boolean' => 'The :attribute field must be true or false.', 31 | 'confirmed' => 'The :attribute confirmation does not match.', 32 | 'date' => 'The :attribute is not a valid date.', 33 | 'date_format' => 'The :attribute does not match the format :format.', 34 | 'different' => 'The :attribute and :other must be different.', 35 | 'digits' => 'The :attribute must be :digits digits.', 36 | 'digits_between' => 'The :attribute must be between :min and :max digits.', 37 | 'distinct' => 'The :attribute field has a duplicate value.', 38 | 'email' => 'The :attribute must be a valid email address.', 39 | 'exists' => 'The selected :attribute is invalid.', 40 | 'filled' => 'The :attribute field is required.', 41 | 'image' => 'The :attribute must be an image.', 42 | 'in' => 'The selected :attribute is invalid.', 43 | 'in_array' => 'The :attribute field does not exist in :other.', 44 | 'integer' => 'The :attribute must be an integer.', 45 | 'ip' => 'The :attribute must be a valid IP address.', 46 | 'json' => 'The :attribute must be a valid JSON string.', 47 | 'max' => [ 48 | 'numeric' => 'The :attribute may not be greater than :max.', 49 | 'file' => 'The :attribute may not be greater than :max kilobytes.', 50 | 'string' => 'The :attribute may not be greater than :max characters.', 51 | 'array' => 'The :attribute may not have more than :max items.', 52 | ], 53 | 'mimes' => 'The :attribute must be a file of type: :values.', 54 | 'min' => [ 55 | 'numeric' => 'The :attribute must be at least :min.', 56 | 'file' => 'The :attribute must be at least :min kilobytes.', 57 | 'string' => 'The :attribute must be at least :min characters.', 58 | 'array' => 'The :attribute must have at least :min items.', 59 | ], 60 | 'not_in' => 'The selected :attribute is invalid.', 61 | 'numeric' => 'The :attribute must be a number.', 62 | 'present' => 'The :attribute field must be present.', 63 | 'regex' => 'The :attribute format is invalid.', 64 | 'required' => 'The :attribute field is required.', 65 | 'required_if' => 'The :attribute field is required when :other is :value.', 66 | 'required_unless' => 'The :attribute field is required unless :other is in :values.', 67 | 'required_with' => 'The :attribute field is required when :values is present.', 68 | 'required_with_all' => 'The :attribute field is required when :values is present.', 69 | 'required_without' => 'The :attribute field is required when :values is not present.', 70 | 'required_without_all' => 'The :attribute field is required when none of :values are present.', 71 | 'same' => 'The :attribute and :other must match.', 72 | 'size' => [ 73 | 'numeric' => 'The :attribute must be :size.', 74 | 'file' => 'The :attribute must be :size kilobytes.', 75 | 'string' => 'The :attribute must be :size characters.', 76 | 'array' => 'The :attribute must contain :size items.', 77 | ], 78 | 'string' => 'The :attribute must be a string.', 79 | 'timezone' => 'The :attribute must be a valid zone.', 80 | 'unique' => 'The :attribute has already been taken.', 81 | 'url' => 'The :attribute format is invalid.', 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Custom Validation Language Lines 86 | |-------------------------------------------------------------------------- 87 | | 88 | | Here you may specify custom validation messages for attributes using the 89 | | convention "attribute.rule" to name the lines. This makes it quick to 90 | | specify a specific custom language line for a given attribute rule. 91 | | 92 | */ 93 | 94 | 'custom' => [ 95 | 'attribute-name' => [ 96 | 'rule-name' => 'custom-message', 97 | ], 98 | ], 99 | 100 | /* 101 | |-------------------------------------------------------------------------- 102 | | Custom Validation Attributes 103 | |-------------------------------------------------------------------------- 104 | | 105 | | The following language lines are used to swap attribute place-holders 106 | | with something more reader friendly such as E-Mail Address instead 107 | | of "email". This simply helps us make messages a little cleaner. 108 | | 109 | */ 110 | 111 | 'attributes' => [], 112 | 113 | ]; 114 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | env('SESSION_DRIVER', 'file'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Lifetime 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify the number of minutes that you wish the session 27 | | to be allowed to remain idle before it expires. If you want them 28 | | to immediately expire on the browser closing, set that option. 29 | | 30 | */ 31 | 32 | 'lifetime' => 120, 33 | 34 | 'expire_on_close' => false, 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Session Encryption 39 | |-------------------------------------------------------------------------- 40 | | 41 | | This option allows you to easily specify that all of your session data 42 | | should be encrypted before it is stored. All encryption will be run 43 | | automatically by Laravel and you can use the Session like normal. 44 | | 45 | */ 46 | 47 | 'encrypt' => false, 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Session File Location 52 | |-------------------------------------------------------------------------- 53 | | 54 | | When using the native session driver, we need a location where session 55 | | files may be stored. A default has been set for you but a different 56 | | location may be specified. This is only needed for file sessions. 57 | | 58 | */ 59 | 60 | 'files' => storage_path('framework/sessions'), 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Session Database Connection 65 | |-------------------------------------------------------------------------- 66 | | 67 | | When using the "database" or "redis" session drivers, you may specify a 68 | | connection that should be used to manage these sessions. This should 69 | | correspond to a connection in your database configuration options. 70 | | 71 | */ 72 | 73 | 'connection' => null, 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Session Database Table 78 | |-------------------------------------------------------------------------- 79 | | 80 | | When using the "database" session driver, you may specify the table we 81 | | should use to manage the sessions. Of course, a sensible default is 82 | | provided for you; however, you are free to change this as needed. 83 | | 84 | */ 85 | 86 | 'table' => 'sessions', 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Session Sweeping Lottery 91 | |-------------------------------------------------------------------------- 92 | | 93 | | Some session drivers must manually sweep their storage location to get 94 | | rid of old sessions from storage. Here are the chances that it will 95 | | happen on a given request. By default, the odds are 2 out of 100. 96 | | 97 | */ 98 | 99 | 'lottery' => [2, 100], 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Session Cookie Name 104 | |-------------------------------------------------------------------------- 105 | | 106 | | Here you may change the name of the cookie used to identify a session 107 | | instance by ID. The name specified here will get used every time a 108 | | new session cookie is created by the framework for every driver. 109 | | 110 | */ 111 | 112 | 'cookie' => 'laravel_session', 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Session Cookie Path 117 | |-------------------------------------------------------------------------- 118 | | 119 | | The session cookie path determines the path for which the cookie will 120 | | be regarded as available. Typically, this will be the root path of 121 | | your application but you are free to change this when necessary. 122 | | 123 | */ 124 | 125 | 'path' => '/', 126 | 127 | /* 128 | |-------------------------------------------------------------------------- 129 | | Session Cookie Domain 130 | |-------------------------------------------------------------------------- 131 | | 132 | | Here you may change the domain of the cookie used to identify a session 133 | | in your application. This will determine which domains the cookie is 134 | | available to in your application. A sensible default has been set. 135 | | 136 | */ 137 | 138 | 'domain' => null, 139 | 140 | /* 141 | |-------------------------------------------------------------------------- 142 | | HTTPS Only Cookies 143 | |-------------------------------------------------------------------------- 144 | | 145 | | By setting this option to true, session cookies will only be sent back 146 | | to the server if the browser has a HTTPS connection. This will keep 147 | | the cookie from being sent to you if it can not be done securely. 148 | | 149 | */ 150 | 151 | 'secure' => false, 152 | 153 | /* 154 | |-------------------------------------------------------------------------- 155 | | HTTP Access Only 156 | |-------------------------------------------------------------------------- 157 | | 158 | | Setting this value to true will prevent JavaScript from accessing the 159 | | value of the cookie and the cookie will only be accessible through 160 | | the HTTP protocol. You are free to modify this option if needed. 161 | | 162 | */ 163 | 164 | 'http_only' => true, 165 | 166 | ]; 167 | -------------------------------------------------------------------------------- /resources/lang/mn/validation.php: -------------------------------------------------------------------------------- 1 | 'Таны оруулсан өгөгдөл буруу байна.', 17 | 18 | 'accepted' => ':attribute баталсан байх шаардлагатай.', 19 | 'active_url' => ':attribute талбарт зөв URL хаяг оруулна уу.', 20 | 'after' => ':attribute талбарт :date-с хойш огноо оруулна уу.', 21 | 'alpha' => ':attribute талбарт латин үсэг оруулна уу.', 22 | 'alpha_dash' => ':attribute талбарт латин үсэг, тоо болон зураас оруулах боломжтой.', 23 | 'alpha_num' => ':attribute талбарт латин үсэг болон тоо оруулах боломжтой.', 24 | 'array' => ':attribute талбар массив байх шаардлагатай.', 25 | 'before' => ':attribute талбарт :date-с өмнөх огноо оруулна уу.', 26 | 'between' => [ 27 | 'numeric' => ':attribute талбарт :min-:max хооронд тоо оруулна уу.', 28 | 'file' => ':attribute талбарт :min-:max килобайт хэмжээтэй файл оруулна уу.', 29 | 'string' => ':attribute талбарт :min-:max урттай текст оруулна уу.', 30 | 'array' => ':attribute массивт :min-:max элемэнт байх шаардлагатай.', 31 | ], 32 | 'boolean' => ':attribute талбарын утга үнэн эсвэл худал байх шаардлагатай.', 33 | 'confirmed' => ':attribute талбарын баталагажуулалт тохирохгүй байна.', 34 | 'date' => ':attribute талбарт оруулсан огноо буруу байна.', 35 | 'date_format' => ':attribute талбарт :format хэлбэртэй огноо оруулна уу.', 36 | 'different' => ':attribute талбарт :other -с өөр утга оруулах шаардлагатай.', 37 | 'digits' => ':attribute талбарт дараах цифрүүдээс оруулах боломжтой. :digits.', 38 | 'digits_between' => ':attribute талбарт :min-:max хоорондох цифр оруулах боломжтой.', 39 | 'dimensions' => ':attribute талбарийн зургийн хэмжээс буруу байна.', 40 | 'distinct' => ':attribute талбарт ялгаатай утга оруулах шаардлагатай.', 41 | 'email' => ':attribute талбарт зөв и-мэйл хаяг оруулах шаардлагатай.', 42 | 'exists' => 'Сонгогдсон :attribute буруу байна.', 43 | 'file' => ':attribute талбарт файл оруулах шаардлагатай.', 44 | 'filled' => ':attribute талбар шаардлагатай.', 45 | 'image' => ':attribute талбарт зураг оруулна уу.', 46 | 'in' => 'Сонгогдсон :attribute буруу байна.', 47 | 'in_array' => ':attribute талбарт оруулсан утга :other -д байхгүй байна.', 48 | 'integer' => ':attribute талбарт бүхэл тоо оруулах шаардлагатай.', 49 | 'ip' => ':attribute талбарт зөв IP хаяг оруулах шаардлагатай.', 50 | 'json' => ':attribute талбарт зөв JSON тэмдэгт мөр оруулах шаардлагатай.', 51 | 'max' => [ 52 | 'numeric' => ':attribute талбарт :max буюу түүнээс бага утга оруулна уу.', 53 | 'file' => ':attribute талбарт :max килобайтаас бага хэмжээтэй файл оруулна уу.', 54 | 'string' => ':attribute талбарт :max-с бага урттай текст оруулна уу.', 55 | 'array' => ':attribute талбарт хамгийн ихдээ :max элемэнт оруулах боломжтой.', 56 | ], 57 | 58 | 'mimes' => ':attribute талбарт дараах төрлийн файл оруулах боломжтой: :values.', 59 | 'mimetypes' => ':attribute талбарт дараах төрлийн файл оруулах боломжтой: :values.', 60 | 'min' => [ 61 | 'numeric' => ':attribute талбарт :min буюу түүнээс их тоо оруулна уу.', 62 | 'file' => ':attribute талбарт :min килобайтаас их хэмжээтэй файл оруулна уу.', 63 | 'string' => ':attribute талбарт :min буюу түүнээс их үсэг бүхий текст оруулна уу.', 64 | 'array' => ':attribute талбарт хамгийн багадаа :min элемэнт оруулах боломжтой.', 65 | ], 66 | 'not_in' => 'Буруу :attribute сонгогдсон байна.', 67 | 'numeric' => ':attribute талбарт тоон утга оруулна уу.', 68 | 'present' => ':attribute талбар байх шаардлагатай.', 69 | 'regex' => ':attribute талбарт оруулсан утга буруу байна.', 70 | 'required' => ':attribute талбар шаардлагатай.', 71 | 'required_if' => 'Хэрэв :other :value бол :attribute табларт утга оруулах шаардлагатай.', 72 | 'required_unless' => ':other :values дотор байхгүй бол :attribute талбарт утга оруулах шаардлагатай.', 73 | 'required_with' => ':values утгуудийн аль нэг байвал :attribute талбар шаардлагатай.', 74 | 'required_with_all' => ':values утгууд байвал :attribute талбар шаардлагатай.', 75 | 'required_without' => ':attribute талбарт :values өгөгдөл байхгүй байна.', 76 | 'required_without_all' => ':attribute талбарын шаардагдсан :values байна.', 77 | 'same' => ':attribute and :other must match.', 78 | 'size' => [ 79 | 'numeric' => ':attribute :size хэмжээтэй байх шаардлагатай.', 80 | 'file' => ':attribute :size килобайт хэмжээтэй байх шаардлагатай.', 81 | 'string' => ':attribute :size тэмдэгтийн урттай байх шаардлагатай.', 82 | 'array' => ':attribute :size элемэнттэй байх шаардлагатай.', 83 | ], 84 | 'string' => ':attribute талбарт текст оруулна уу.', 85 | 'timezone' => ':attribute талбарт зөв цагийн бүс оруулна уу.', 86 | 'unique' => 'Оруулсан :attribute аль хэдий нь бүртгэгдсэн байна.', 87 | 'uploaded' => ':attribute талбарт оруулсан файлыг хуулхад алдаа гарлаа.', 88 | 'url' => ':attribute зөв url хаяг оруулна уу.', 89 | /* 90 | |-------------------------------------------------------------------------- 91 | | Custom Validation Language Lines 92 | |-------------------------------------------------------------------------- 93 | | 94 | | Here you may specify custom validation messages for attributes using the 95 | | convention "attribute.rule" to name the lines. This makes it quick to 96 | | specify a specific custom language line for a given attribute rule. 97 | | 98 | */ 99 | 100 | 'custom' => [ 101 | 'attribute-name' => [ 102 | 'rule-name' => 'custom-message', 103 | ], 104 | 'g-recaptcha-response' => [ 105 | 'required' => 'Recaptcha талбарыг бөглөх шаардлагатай.', 106 | ], 107 | ], 108 | 109 | /* 110 | |-------------------------------------------------------------------------- 111 | | Custom Validation Attributes 112 | |-------------------------------------------------------------------------- 113 | | 114 | | The following language lines are used to swap attribute place-holders 115 | | with something more reader friendly such as E-Mail Address instead 116 | | of "email". This simply helps us make messages a little cleaner. 117 | | 118 | */ 119 | 120 | 'attributes' => [ 121 | 'first_name' => 'Нэр', 122 | 'last_name' => 'Овог', 123 | 'email' => 'И-мэйл', 124 | 'start' => 'Эхлэх', 125 | 'end' => 'Дуусах', 126 | 'price' => 'Үнэ', 127 | 'amount' => 'Дүн', 128 | 'gender' => 'Хүйс', 129 | 'photo' => 'Зураг', 130 | 'address1' => 'Хаяг 1', 131 | 'address2' => 'Хаяг 2', 132 | 'category_id' => 'Төрөл', 133 | ], 134 | 135 | 'recaptcha' => 'Recaptcha алдаатай байна.', 136 | 137 | ]; 138 | -------------------------------------------------------------------------------- /config/app.php: -------------------------------------------------------------------------------- 1 | env('APP_ENV', 'production'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Application Debug Mode 21 | |-------------------------------------------------------------------------- 22 | | 23 | | When your application is in debug mode, detailed error messages with 24 | | stack traces will be shown on every error that occurs within your 25 | | application. If disabled, a simple generic error page is shown. 26 | | 27 | */ 28 | 29 | 'debug' => env('APP_DEBUG', true), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Application URL 34 | |-------------------------------------------------------------------------- 35 | | 36 | | This URL is used by the console to properly generate URLs when using 37 | | the Artisan command line tool. You should set this to the root of 38 | | your application so that it is used when running Artisan tasks. 39 | | 40 | */ 41 | 42 | 'url' => env('APP_URL', 'http://localhost'), 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Application Timezone 47 | |-------------------------------------------------------------------------- 48 | | 49 | | Here you may specify the default timezone for your application, which 50 | | will be used by the PHP date and date-time functions. We have gone 51 | | ahead and set this to a sensible default for you out of the box. 52 | | 53 | */ 54 | 55 | 'timezone' => 'UTC', 56 | 57 | /* 58 | |-------------------------------------------------------------------------- 59 | | Application Locale Configuration 60 | |-------------------------------------------------------------------------- 61 | | 62 | | The application locale determines the default locale that will be used 63 | | by the translation service provider. You are free to set this value 64 | | to any of the locales which will be supported by the application. 65 | | 66 | */ 67 | 68 | 'locale' => 'mn', 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Application Fallback Locale 73 | |-------------------------------------------------------------------------- 74 | | 75 | | The fallback locale determines the locale to use when the current one 76 | | is not available. You may change the value to correspond to any of 77 | | the language folders that are provided through your application. 78 | | 79 | */ 80 | 81 | 'fallback_locale' => 'mn', 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Encryption Key 86 | |-------------------------------------------------------------------------- 87 | | 88 | | This key is used by the Illuminate encrypter service and should be set 89 | | to a random, 32 character string, otherwise these encrypted strings 90 | | will not be safe. Please do this before deploying an application! 91 | | 92 | */ 93 | 94 | 'key' => env('APP_KEY'), 95 | 96 | 'cipher' => 'AES-256-CBC', 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Logging Configuration 101 | |-------------------------------------------------------------------------- 102 | | 103 | | Here you may configure the log settings for your application. Out of 104 | | the box, Laravel uses the Monolog PHP logging library. This gives 105 | | you a variety of powerful log handlers / formatters to utilize. 106 | | 107 | | Available Settings: "single", "daily", "syslog", "errorlog" 108 | | 109 | */ 110 | 111 | 'log' => env('APP_LOG', 'single'), 112 | 113 | /* 114 | |-------------------------------------------------------------------------- 115 | | Autoloaded Service Providers 116 | |-------------------------------------------------------------------------- 117 | | 118 | | The service providers listed here will be automatically loaded on the 119 | | request to your application. Feel free to add your own services to 120 | | this array to grant expanded functionality to your applications. 121 | | 122 | */ 123 | 124 | 'providers' => [ 125 | 126 | /* 127 | * Laravel Framework Service Providers... 128 | */ 129 | Illuminate\Auth\AuthServiceProvider::class, 130 | Illuminate\Broadcasting\BroadcastServiceProvider::class, 131 | Illuminate\Bus\BusServiceProvider::class, 132 | Illuminate\Cache\CacheServiceProvider::class, 133 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, 134 | Illuminate\Cookie\CookieServiceProvider::class, 135 | Illuminate\Database\DatabaseServiceProvider::class, 136 | Illuminate\Encryption\EncryptionServiceProvider::class, 137 | Illuminate\Filesystem\FilesystemServiceProvider::class, 138 | Illuminate\Foundation\Providers\FoundationServiceProvider::class, 139 | Illuminate\Hashing\HashServiceProvider::class, 140 | Illuminate\Mail\MailServiceProvider::class, 141 | Illuminate\Pagination\PaginationServiceProvider::class, 142 | Illuminate\Pipeline\PipelineServiceProvider::class, 143 | Illuminate\Queue\QueueServiceProvider::class, 144 | Illuminate\Redis\RedisServiceProvider::class, 145 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, 146 | Illuminate\Session\SessionServiceProvider::class, 147 | Illuminate\Translation\TranslationServiceProvider::class, 148 | Illuminate\Validation\ValidationServiceProvider::class, 149 | Illuminate\View\ViewServiceProvider::class, 150 | Collective\Html\HtmlServiceProvider::class, 151 | 152 | /* 153 | * Application Service Providers... 154 | */ 155 | App\Providers\AppServiceProvider::class, 156 | App\Providers\AuthServiceProvider::class, 157 | App\Providers\EventServiceProvider::class, 158 | App\Providers\RouteServiceProvider::class, 159 | 160 | ], 161 | 162 | /* 163 | |-------------------------------------------------------------------------- 164 | | Class Aliases 165 | |-------------------------------------------------------------------------- 166 | | 167 | | This array of class aliases will be registered when this application 168 | | is started. However, feel free to register as many as you wish as 169 | | the aliases are "lazy" loaded so they don't hinder performance. 170 | | 171 | */ 172 | 173 | 'aliases' => [ 174 | 175 | 'App' => Illuminate\Support\Facades\App::class, 176 | 'Artisan' => Illuminate\Support\Facades\Artisan::class, 177 | 'Auth' => Illuminate\Support\Facades\Auth::class, 178 | 'Blade' => Illuminate\Support\Facades\Blade::class, 179 | 'Cache' => Illuminate\Support\Facades\Cache::class, 180 | 'Config' => Illuminate\Support\Facades\Config::class, 181 | 'Cookie' => Illuminate\Support\Facades\Cookie::class, 182 | 'Crypt' => Illuminate\Support\Facades\Crypt::class, 183 | 'DB' => Illuminate\Support\Facades\DB::class, 184 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 185 | 'Event' => Illuminate\Support\Facades\Event::class, 186 | 'File' => Illuminate\Support\Facades\File::class, 187 | 'Gate' => Illuminate\Support\Facades\Gate::class, 188 | 'Hash' => Illuminate\Support\Facades\Hash::class, 189 | 'Lang' => Illuminate\Support\Facades\Lang::class, 190 | 'Log' => Illuminate\Support\Facades\Log::class, 191 | 'Mail' => Illuminate\Support\Facades\Mail::class, 192 | 'Password' => Illuminate\Support\Facades\Password::class, 193 | 'Queue' => Illuminate\Support\Facades\Queue::class, 194 | 'Redirect' => Illuminate\Support\Facades\Redirect::class, 195 | 'Redis' => Illuminate\Support\Facades\Redis::class, 196 | 'Request' => Illuminate\Support\Facades\Request::class, 197 | 'Response' => Illuminate\Support\Facades\Response::class, 198 | 'Route' => Illuminate\Support\Facades\Route::class, 199 | 'Schema' => Illuminate\Support\Facades\Schema::class, 200 | 'Session' => Illuminate\Support\Facades\Session::class, 201 | 'Storage' => Illuminate\Support\Facades\Storage::class, 202 | 'URL' => Illuminate\Support\Facades\URL::class, 203 | 'Validator' => Illuminate\Support\Facades\Validator::class, 204 | 'View' => Illuminate\Support\Facades\View::class, 205 | 'Form' => Collective\Html\FormFacade::class, 206 | 'Html' => Collective\Html\HtmlFacade::class, 207 | 208 | 209 | ], 210 | 211 | ]; 212 | --------------------------------------------------------------------------------