Simple and Easy Laravel 5.2 Login and Register using the auth scaffold

Simple and Easy Laravel 5.2 Login and Register using the auth scaffold

Simple and Easy Laravel 5.2 Login and Register using the auth scaffold

Here i am going to use Laravel auth scaffolding to login and register, its very easy to integrate login and register system in Laravel.

Step 1: Install Laravel 5.2

If Laravel is not installed in your system then first install with following command and get fresh Laravel project.

composer create-project --prefer-dist laravel/laravel blog "5.2.*"

When you run above command then it create application with name blog in your system.From Laravel 5, you have to install laravelcollective/html for Form class.To know the installation process of laravelcollective/html, kindly go through this url HTML/FORM not found in Laravel 5?.

Step 2: Create users table and model

Follow the simple step to create users table in your database.First create migration for users table using Laravel 5 php artisan command,so first run this command -

php artisan make:migration create_users_table

After this command, you will see a migration file in following path database/migrations and you have to simply put following code in migration file to create users table.

  1. use Illuminate\Database\Schema\Blueprint;
  2. use Illuminate\Database\Migrations\Migration;
  3. class CreateUsersTable extends Migration
  4. {
  5. /**
  6. * Run the migrations.
  7. *
  8. * @return void
  9. */
  10. public function up()
  11. {
  12. Schema::create('users', function (Blueprint $table) {
  13. $table->increments('id');
  14. $table->string('name');
  15. $table->string('email')->unique();
  16. $table->string('password');
  17. $table->rememberToken();
  18. $table->timestamps();
  19. });
  20. }
  21. /**
  22. * Reverse the migrations.
  23. *
  24. * @return void
  25. */
  26. public function down()
  27. {
  28. Schema::drop('users');
  29. }
  30. }

Save this migration file and run following command

php artisan migrate

If you receive a "class not found" error when running migrations, try running the composer dump-autoload command and re-issuing the migrate command.

Now you have successfully created `users` table.You won't have to create user model, it is created by default in following path app/User.php when you install Laravel.

  1. namespace App;
  2. use Illuminate\Foundation\Auth\User as Authenticatable;
  3. class User extends Authenticatable
  4. {
  5. /**
  6. * The attributes that are mass assignable.
  7. *
  8. * @var array
  9. */
  10. protected $fillable = [
  11. 'name', 'email', 'password',
  12. ];
  13. /**
  14. * The attributes that should be hidden for arrays.
  15. *
  16. * @var array
  17. */
  18. protected $hidden = [
  19. 'password', 'remember_token',
  20. ];
  21. }
Step 3: The auth scaffold in Laravel 5.2

Laravel provide a short cut to create auth section

php artisan make:auth

After successfully run command, Laravel create complete auth section which you will see in your command promt -

php artisan make:auth

List of files and folder which is generated by above command :

It generate a master layout which is core of scaffold resources/views/layouts/app.blade.php

List of views that extend it :

  • welcome.blade.php - the welcome page
  • home.blade.php - the landing page for logged-in users
  • auth/login.blade.php - the login page
  • auth/register.blade.php - the register or signup page
  • auth/passwords/email.blade.php - the password reset confirmation page
  • auth/passwords/reset.blade.php - the password reset prompt page
  • auth/emails/password.blade.php - the password reset email

Changes in routes.php :

  1. Route::auth();
  2. Route::get('/home', 'HomeController@index');

The Route::auth() is a set of common authentication, registration and password reset routes.

  1. // Authentication Routes...
  2. $this->get('login', 'Auth\AuthController@showLoginForm');
  3. $this->post('login', 'Auth\AuthController@login');
  4. $this->get('logout', 'Auth\AuthController@logout');
  5. // Registration Routes...
  6. $this->get('register', 'Auth\AuthController@showRegistrationForm');
  7. $this->post('register', 'Auth\AuthController@register');
  8. // Password Reset Routes...
  9. $this->get('password/reset/{token?}', 'Auth\PasswordController@showResetForm');
  10. $this->post('password/email', 'Auth\PasswordController@sendResetLinkEmail');
  11. $this->post('password/reset', 'Auth\PasswordController@reset');

Benefits of using scaffolding in Laravel is you don't have to create routes, controllers and views for login and register.It helps you to save 30 to 60 minutes of typing on every app that needs it.

Now let's have a look at what we get in browser.

Phone: (+91) 8800417876
Noida, 201301
okey metin2 pvp serverler metin2 pvp
ataşehir escort maltepe escort bostancı escort kadıköy escort maltepe escort ataşehir escort tuzla escort pendik escort ümraniye escort kartal escort
pendik escort
izmir escort izmir escort izmir escort izmir escort denizli escort antalya escort antalya escort antalya escort izmir escort izmir escort izmir escort izmir escort izmir escort
hatay escort nevsehir escort nigde escort kirikkale escort batman escort osmaniye escort kirklareli escort tokat escort rize escort adiyaman escort gumushane escort batman escort
cialis satış cialis fiyat cialis 20 mg cialis 100 mg cialis 5 mg fiyat

viagra fiyatı

viagra 100 mg fiyat

viagra sipariş

orjinal viagra

viagra satın al

izmir escort
ataşehir escort
kocaeli escort izmit escort bayan gebze escort izmit sınırsız escort escort bursa tuzla escort aydınlı escort orhanlı escort bursa escort escort bayan istanbul escort istanbul sınırsız escort istanbul bayan escort izmit escort izmit escort kocaeli escort sisli escort mecidiyekoy escort bursa escort bayan bursa görükle escort maltepe escort goztepe escort yakacik-yeni-escort bursa sınırsız escort sisli escort bayan taksim escort bursa escort porno izle sikiş izle atasehir escort antalya escort
ankara escort marmaris escort bursa escort mersin escort antalya escort izmir escort samsun escort bodrum escort çeşme escort kuşadası escort adana escort eskişehir escort gaziantep escort esenyurt escort pendik escort tuzla escort fatih escort ümraniye escort mecidiyeköy escort kartal escort bahçelievler escort bahçeşehir escort ataşehir escort bakırköy escort nişantaşı escort avcılar escort büyükçekmece escort kurtkoy escort konya escort beşiktaş escort taksim escort beylikdüzü escort malatya escort sakarya escort şişli escort maltepe escort kadıköy escort ataköy escort bostancı escort şirinevler escort bağcılar escort üsküdar escort etiler escort başaksehir escort ortaköy escort kağıthane escort sultangazi escort halkalı escort çekmeköy escort şaşkınbakkal escort mamak escort sincan escort keçiören escort çankaya escort beypazarı escort akyurt escort pursaklar escort kahramankazan escort göztepe escort alsancak escort bornova escort buca escort karabaglar escort karşıyaka escort konak escort narlıdere escort izmit escort başiskele escort kandira escort körfez escort karamürsel escort dilovası escort gölcük escort gebze escort kocaeli escort kayseri escort elazığ escort denizli escort diyarbakir escort adana escort ankara escort izmir escort antalya escort gaziantep escort kayseri escort konya escort mersin escort denizli escort kocaeli escort diyarbakır escort
bedava bahis