Laravel Classroom image

CiliSp
 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5|Last
Lessons:-Authentication

14.2 Setting up the form
Righto! We are going to need a login form, let’s make a pretty one with blade! We love Blade
now right? Let’s do it. Creating login.blade.php..
1 {{ Form::open('login') }}
2
3 <!-- check for login errors flash var -->
4 @if (Session::has('login_errors'))
5 <span class="error">Username or password incorrect.</span>
6 @endif
7
8 <!-- username field -->
9 <p>{{ Form::label('username', 'Username') }}</p>
10 <p>{{ Form::text('username') }}</p>
11
12 <!-- password field -->
13 <p>{{ Form::label('password', 'Password') }}</p>
14 <p>{{ Form::password('password') }}</p>
15
16 <!-- submit button -->
17 <p>{{ Form::submit('Login') }}</p>
18
19 {{ Form::close() }}
That is a beautif..
Ssssh, that was a few chapters ago now, I’m not into brain washing, you can let it go. Sure is a
beautiful form though! Let’s create a nice route to show the form.
1 <?php
2
3 Route::get('login', function() {
4 return View::make('login');
5 });
Let’s make a POST variant of this route, we can use that to handle when the login form is
submitted. That way we can use a single URL for both.1 <?php
2
3 Route::post('login', function() {
4 return 'login form sent';
5 });
Right let’s make sure our routes work fine, actually I am pretty sure they will, but this is just
a habit of mine. If we visit ‘http://localhost/login’ and enter some phoney data and submit the
form we should get login form sent.

 

 
 
 

CiliSp

Skills    Laravel

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)