Create Login registration in Laravel, Authecantation in Laravel, Crate Login in Laravel

<h3>Create Login registration in Laravel, Authecantation in Laravel, Crate Login in Laravel</h3>
keyword:laravel login, laravel registration,session in laravel, authencation in laravel, login logout in laravel, setup in laravel, routes in laravel,migration in laravel.
metadescription: Laravel login, how to create registration in laravel, how to login registration in laravel, Authcantation in laravel, create user login registration,create migration in laravel.

<h3>Create Login registration in Laravel, Authecantation in Laravel, Crate Login in Laravel</h3>
step1: First create Configuring the Routes for login and registration. in laravel in the routes are important part because the in laravel the request first going in routes and then the the routes send request to controller. so lets Create routes. go to App->routes.php

<?php
Route::get('/','UsersController@index');////////////////////////get index view
Route::get('login','UsersController@getLogin');//////////////////////get login view
Route::get('users/register','UsersController@getRegister');///////////////////get registration view
Route::Post('users/register', 'UsersController@postCreate');//////////////// post data
Route::get('users/logout', function()
{
Auth::logout();
return Redirect::to('/');
});///////////////////////////////////////////////////////////////logout

?>

step2: Now create UsersController in app/controllers/UsersController.php you can also use

php artisan generate:controller UsersController

for create user controller. new create  function in user controller and create funcation in index.

<?php

class UsersController extends BaseController {

public function __construct() {
//$latest = post::orderBy('id', 'desc')->limit(3)->get();///////////////////these is used for allow post
//View::share('latest', $latest);
$this->beforeFilter('csrf', array('on'=>'post'));
$this->beforeFilter('auth', array('only'=>array('getDashboard','logout')));
}

protected $layout = "layouts.front";////////////////////////////////create master layout

public function index()
{

$this->layout->content = View::make('pages.index');

}

}?>

step:3 Now create Master layout for all function so create in app->view->layouts and create front.blade.php and insert the folling code we are use a theme so create a folder in app->view->include and create two file first header.blade.php and insert the follwing code.

<div id="templatemo_site_title_bar_wrapper">
<div id="templatemo_site_title_bar">
<div id="site_title">
<h1><a href="http://www.templatemo.com" target="_parent">Yellow Blog
<span>free html css template</span>
</a></h1>
</div>

<div id="search_box">
<form action="#" method="get">
<input type="text" value="Enter keyword here..." name="q" size="10" id="searchfield" title="searchfield" onfocus="clearText(this)" onblur="clearText(this)" />
<input type="submit" name="Search" value="" alt="Search" id="searchbutton" title="Search" />
</form>
</div>

</div>

</div>

<div id="templatemo_menu_wrapper">
<div id="templatemo_menu">
<ul class="nav">
@if(!Auth::check())
<li>{{ HTML::link('users/register', 'Register') }}</li>
<li>{{ HTML::link('users/login', 'Login') }}</li>
@else
<li>{{ HTML::link('users/logout', 'logout') }}</li>
@endif
</ul>
</div>
</div>

Now create another file in app->view->footer.blade.php and insert follwing code

<div id="templatemo_footer_wrapper">

<div id="templatemo_footer">

<div class="section_w200">

<h4>Services</h4>
<ul class="footer_menu_list">
<li><a href="#">Lorem ipsum dolor</a></li>
<li><a href="#">Cum sociis</a></li>
<li><a href="#">Donec quam</a></li>
<li><a href="#">Nulla consequat</a></li>
<li><a href="#">In enim justo</a></li>
</ul>

</div>

<div class="section_w200">

<h4>About</h4>
<ul class="footer_menu_list">
<li><a href="#">Nullam quis</a></li>
<li><a href="#">Sed consequat</a></li>
<li><a href="#">Cras dapibus</a></li>
<li><a href="#">Lorem ipsum dolor</a></li>
<li><a href="#">Cum sociis</a></li>
</ul>

</div>

<div class="section_w200">

<h4>Partners</h4>
<ul class="footer_menu_list">
<li><a href="http://www.templatemo.com" target="_parent">CSS Templates</a></li>
<li><a href="http://www.flashmo.com" target="_parent">Flash Templates</a></li>
<li><a href="http://www.templatemo.com/page/2" target="_parent">Website Templates</a></li>
<li><a href="http://www.webdesignmo.com" target="_parent">Web Design Tips</a></li>
<li><a href="http://www.koflash.com" target="_blank">Flash Gallery</a></li>
</ul>

</div>

<div class="section_w260">

<h4>Privacy Policy</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut non rutrum arcu. Vestibulum ornare dolor eget leo placerat sed tincidunt dolor interdum</p>

<div class="cleaner_h10"></div>

<a href="http://validator.w3.org/check?uri=referer"><img style="border:0;width:88px;height:31px" src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" width="88" height="31" vspace="8" border="0" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img style="border:0;width:88px;height:31px"  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" vspace="8" border="0" /></a>

</div>

<div class="cleaner_h20"></div>

<div class="section_w860">
Copyright © 2048 <a href="#">Your Company Name</a> | <a href="http://www.iwebsitetemplate.com" target="_parent">Website Templates</a> by <a href="http://www.templatemo.com" target="_parent">Free CSS Templates</a>
</div>

</div> <!-- end of footer -->
</div>
<div align=center>This template  downloaded form <a href='http://all-free-download.com/free-website-templates/'>free website templates</a></div></body>

app->view->layouts and create front.blade.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Blogers.com</title>
<meta name="keywords" content="yellow blog template, free html css layout" />
<meta name="description" content="yellow blog template, free html css layout from TemplateMo.com" />
{{ HTML::style('css/templatemo_style.css')}}
<script language="javascript" type="text/javascript">
function clearText(field)
{
if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;
}
</script>
</head>
<body>
@include('include.header')
<div id="templatemo_content_wrapper_outer">

<div id="templatemo_content_wrapper_inner">

<div id="templatemo_content_wrapper">

@if(Session::has('message'))
<p class="alert">{{ Session::get('message') }}</p>
@endif

{{ $content }}

<div class="cleaner"></div>

</div>

<div class="cleaner"></div>
</div>

</div>
@include('include.footer')

</html>

<h4>Now create a css file in Public templatemo_style.css</h4>

body {
margin: 0;
padding: 0;
line-height: 1.5em;
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
color: #000000;
background: #1b9bd7;
}

a:link, a:visited { color: #0066CC; text-decoration: none; font-weight: normal; }
a:active, a:hover { color: #FF0066; text-decoration: underline; }

p { margin: 0px; padding: 0px; text-align: justify; }

img { margin: 0px; padding: 0px; border: none; }

.cleaner { clear: both; width: 100%; height: 0px; font-size: 0px;  }

.cleaner_h10 { clear: both; width:100%; height: 10px; }
.cleaner_h20 { clear: both; width:100%; height: 20px; }
.cleaner_h30 { clear: both; width:100%; height: 30px; }
.cleaner_h40 { clear: both; width:100%; height: 40px; }
.cleaner_h50 { clear: both; width:100%; height: 50px; }
.cleaner_h60 { clear: both; width:100%; height: 60px; }

.fl { float: left; }
.fr { float: right; }

.m_right { margin-right: 30px; }

.button_01 a {
display: block;
width: 90px;
height: 24px;
padding: 6px 0 0 30px;

background: url(../img/templatemo_button_01.jpg) no-repeat;

color: #191717;
font-size: 14px;
font-weight: bold;
text-align: center;
text-decoration: none;
}

h1 {
margin: 0px;
padding: 2px 0;
font-size: 30px;
font-weight: bold;
}

h2 {
position: relative;
height: 25px;
margin: 0px;
padding: 10px 0 0 0;
font-size: 20px;
font-weight: bold;
text-align: center;
}

h3 {
margin: 0 0 10px 0;
padding: 2px 0 5px 0;
font-size: 20px;
font-weight: normal;
color: #333;
border-bottom: 1px dotted #333;
}

h4 {
margin: 0 0 0 0;
padding: 0 0 5px 0;
font-size: 14px;
color: #ffffff;
font-weight: bold;
}

.image_wrapper {
border: 1px solid #ffffff;
margin-top: 3px;
margin-bottom: 5px;
}

.fl_image {
float: left;
margin-right: 15px
}

.fr_image {
float: right;
margin-left: 15px
}

.list_01 {
margin: 0 0 20px 40px;
padding: 0px;
}

.list_01 li {
margin: 0px;
padding: 0 0 10px 0;
list-style-image: url(img/templatemo_list_icon_01.jpg);
}

.list_01 li a {
color: #ffffff;
}

#templatemo_site_title_bar_wrapper {
width: 100%;
height: 110px;
background: url(../img/templatemo_title_bar_repeat.jpg) repeat-x;
}

#templatemo_site_title_bar {
width: 780px;
height: 110px;
padding: 0 90px;
margin: 0 auto;
background: url(../img/templatemo_title_bar_bg_with_search.jpg) center no-repeat;
}

#templatemo_site_title_bar  #site_title {
float: left;
padding-top: 30px;
padding-bottom: 10px;
width: 500px;
}

#site_title h1 a {
margin: 0px;
padding: 0px;
font-size: 36px;
color: #000000;
font-weight: normal;
text-decoration: none;
}

#site_title h1 a:hover {
font-weight: normal;
text-decoration: none;
}

#site_title h1 a span {
display: block;
margin-top: 10px;
font-size: 14px;
color: #000000;
}

#templatemo_site_title_bar #search_box {
float: right;
width: 240px;
height: 30px;
margin: 17px 0 0 0;
padding: 0 15px;
}

#search_box form {
float: left;
width: 240px;
height: 30px;
margin: 0;
padding: 0;
}

#searchfield {
height: 16px;
width: 185px;
padding: 5px;
margin: 0px;
color: #000000;
font-size: 12px;
font-variant: normal;
line-height: normal;
background: none;
border: none;
}

#searchbutton {
height: 30px;
width: 42px;
margin: 0px;
padding: 6px 0;
cursor: pointer;
font-size: 12px;
text-align: center;
vertical-align: bottom;
white-space: pre;
color: #ffffff;
background: none;
border: none;
}

#templatemo_menu_wrapper {
width: 100%;
height: 60px;
background: url(../img/templatemo_menu_bar_repeat.jpg) repeat-x;
}

#templatemo_menu {
width: 860px;
height: 60px;
margin: 0 auto;
padding: 0 50px;
background: url(../img/templatemo_menu_bar_bg.jpg) center no-repeat;
}

#templatemo_menu ul {
width: 750px;
overflow: hidden;
padding: 15px 0 0 0;
margin: 0px auto;
list-style: none;
}

#templatemo_menu ul li {
padding: 0px;
margin: 0px;
display: inline;
}

#templatemo_menu ul li a {
float: left;
display: block;
height: 25px;
width: 100px;
padding: 5px 5px 0 0;
margin: 0 10px;
font-size: 14px;
text-align: center;
font-weight: bold;
text-decoration: none;
color: #292922;
background: url(../img/templatemo_menu_right.jpg) right top no-repeat;
outline: none;
}

#templatemo_menu li a:hover, #templatemo_menu li .current {
position: relative;
background: url(../img/templatemo_menu_hover_right.png) right no-repeat;
}

#templatemo_menu li a:hover span, #templatemo_menu li .current span {
position: absolute;
top: 0px;
left: -5px;
width: 5px;
height: 30px;
background: url(../img/templatemo_menu_hover_left.png) right no-repeat;
}

#templatemo_content_wrapper_outer {
width: 100%;
background: url(../img/templatemo_content_wrapper_outrer_repeat.jpg) top repeat-x;
}

#templatemo_content_wrapper_inner {
width: 100%;
margin: 0 auto;
background: url(../img/templatemo_content_wrapper_outrer.jpg) center top no-repeat;
}

#templatemo_content_wrapper {
width: 960px;
margin: 0 auto;
background: url(../img/templatemo_content_bg.png) center repeat-y;
}

#templatemo_content {
position: relative;
width: 780px;
margin: 0 auto;
padding: 40px 90px 0 90px;
margin-bottom: 15px;
background: url(../img/templatemo_content_wrapper_inner.jpg) center top no-repeat;
}

#templatemo_content .content_bottom {
position: absolute;
width: 960px;
height: 15px;
bottom: -15px;
left: 0px;
background:url(../img/templatemo_content_bottom.png) no-repeat;
}

#main_column {
float: left;
width: 450px;
}

#side_column {
float: right;
width: 260px;
padding: 0 15px;
}

#main_column .post_box {
clear: both;
margin-bottom: 50px;
}

.post_box h2 {
font-size: 24px;
color: #4f4f4f;
padding: 2px 0;
margin-bottom: 10px;
text-align: left;
}

.post_box .post_info {
width: 100%;
color: #666;
background: #fffd41;
}

.post_box .post_info a {
color: #666;
text-decoration: none;
}

.post_box .post_info a:hover {
color: #333;
}

.post_info .post_date {
float: left;
padding: 2px 0;
width: 120px;
text-align: center;
background: #c3e368;
}

.post_info .post_author {
float: left;
padding: 2px 0;
width: 120px;
text-align: center;
background: #71d2ff;
}

.post_info .post_comment {
float: left;
padding: 2px 0;
width: 120px;
text-align: center;
background: #88b4fe;
}

.post_box .post_body {
clear: both;
padding: 30px 0 20px 0;
background: url(../img/templatemo_post_body_bg.png) top center no-repeat;
}

.post_body img {
border: 1px solid #CCC;
margin-bottom: 15px;
}

.post_body p {
margin-bottom: 10px;
}

.post_box .continue a {
display: block;
width: 80px;
padding: 2px 0;
text-align: center;
color: #4c7fd4;
font-weight: bold;
background: #dfe0e1;
border-left: 5px solid #88b4fe;
}

#side_column .ads_250_250 {
border: 5px solid #ccc;
}

#side_column .side_column_section {
clear: both;
width: 260px;
}

.ads_125_125 {
float: left;
width: 125px;
height: 125px;
margin: 0 0 10px 0;
}

.right_padding_10 {
margin-right: 10px;
}

.recent_post {
color: #747474;
margin-bottom: 5px;
padding-bottom: 5px;
border-bottom: 1px solid #ccc;
}

.recent_post h4 a {
font-size: 12px;
color: #3fa7d8;
font-weight: bold;
}
.recent_post h4 a:hover {
text-decoration: none;
color: #FF0066;
}

.side_column_section ul {
margin: 0px;
padding: 0px;
list-style: none;
}

.side_column_section li {
margin: 0 0 3px 0;
padding: 0px;
}

.side_column_section li a {
display: block;
width: 240px;
padding: 2px 10px;
color: #666;
outline: none;
background: #a0c3ff;
}

.side_column_section li a:hover {
background: #d9ee9f;
text-decoration: none;
}

#templatemo_footer_wrapper {
width: 100%;
background: url(../img/templatemo_footer_wrapper.jpg) bottom repeat-x;
}

#templatemo_footer {
width: 860px;
min-height: 180px;
margin: 0 auto;
padding: 50px;
color: #ffffff;
background: url(../img/templatemo_footer_bg.jpg) center bottom no-repeat;
}

.section_w860 {
text-align: center;
width: 920px;
}

.section_w860 a {
color: #ffffff;
}

.section_w200 {
float: left;
width: 180px;
padding: 0 20px 0 0;
}

.section_w260 {
float: left;
width: 260px;
padding: 0 0 0 0;
}

.footer_menu_list {
margin: 0px;
padding: 0px;
list-style: none;
}

.footer_menu_list li {
margin: 0px;
padding: 0px;
}

.footer_menu_list li a {
color: #ffffff;
font-weight: normal;
text-decoration: none;
}

.footer_menu_list li a:hover {
color: #ffffff;
text-decoration: none;
}

Now create a folder and create a name pages and create index.blade.php empty file we are use the file letter

Now run your project
laravel1

step4: Now create a function in controller


public function getLogin() {
//$name=Auth::user()->first_name;
if(!empty(Auth::user()->first_name))
{
return Redirect::to('posts/index')->with('message', 'Post is Successfully Updated')->withInput();

}else{

// echo "This is Login Panel";
$this->layout->content = View::make('users.login');}
}
public function postCreate() {
//print_r($_POST);die;

$validator = Validator::make(Input::all(), User::$rules);
if ($validator->passes()) {
$user = new User;
$user->first_name = Input::get('firstname');
$user->last_name = Input::get('lastname');
$user->email = Input::get('email');
$user->password = Hash::make(Input::get('password'));
$user->remember_token = Input::get('_token');
//print_r($user);die;
$user->save();
return Redirect::to('users/login')->with('message', 'Thanks for registering!');
} else {
return Redirect::to('users/register')->with('message', 'The following errors occurred')->withErrors($validator)->withInput();
}

}

step5: Now create a folder in app->view->User

login.blade.php

<style>
input {
font-family: 'Lucida Grande', Tahoma, Verdana, sans-serif;
font-size: 14px;
}

input[type=text], input[type=password] {
margin: 5px;
padding: 0 10px;
width: 200px;
height: 34px;
color: #404040;
background: white;
border: 1px solid;
border-color: #c4c4c4 #d1d1d1 #d4d4d4;
border-radius: 2px;
outline: 5px solid #eff4f7;
-moz-outline-radius: 3px; // Can we get this on WebKit please?
}

input[type=submit] {
padding: 0 18px;
height: 29px;
font-size: 12px;
font-weight: bold;
color: #527881;
text-shadow: 0 1px #e3f1f1;
background: #cde5ef;
border: 1px solid;
border-color: #b4ccce #b3c0c8 #9eb9c2;
border-radius: 16px;
outline: 0;
}

.lt-ie9 {
input[type=text], input[type=password] { line-height: 34px; }
}
</style>
<div id="templatemo_content">
<div class="content_bottom"></div>

<div id="main_column">

<div class="post_box">

{{ Form::open(array('url'=>'users/signin', 'class'=>'form-signin')) }}

<h2><a href="#">Please Login</a></h2>
{{ Form::text('email', null, array('class'=>'input-block-level', 'placeholder'=>'Email Address')) }}<br>
{{ Form::password('password', array('class'=>'input-block-level', 'placeholder'=>'Password')) }}<br>

{{ Form::submit('Login', array('class'=>'btn btn-large btn-primary btn-block'))}}
{{ Form::close() }}

</div> <!-- end of a post -->

</div> <!-- end of main column -->

<div id="side_column">

<div class="ads_250_250">
<a href="http://www.flashmo.com" target="_blank" title="free flash template"><img src="<?php echo $url = asset('img/templatemo_ads_02.jpg'); ?&gt;" alt="free flash template" /></a>                </div>

<div class="cleaner_h30">&nbsp;</div>

<div class="side_column_section">

<div class="ads_125_125 right_padding_10">
<a href="#"><img src="<?php echo $url = asset('img/templatemo_ads.jpg'); ?&gt;" alt="image" /></a>
</div>

<div class="ads_125_125">
<a href="#"><img src="<?php echo $url = asset('img/templatemo_ads.jpg'); ?&gt;" alt="image" /></a>
</div>

</div>

<div class="cleaner_h30">&nbsp;</div>

<div class="side_column_section">

<h3>Archives</h3>
<ul>
<li><a href="#">Poltic News</a></li>
<li><a href="#">Bollywood News</a></li>
<li><a href="#">Hollywood News</a></li>
<li><a href="#">Latest News</a></li>

</ul>

</div>

<div class="cleaner_h30">&nbsp;</div>

<div class="side_column_section">

<h3>Recent Posts</h3>

</div>

</div> <!-- end of side column -->

<div class="cleaner"></div>
</div>

create a file name register.blade.php in app->view->User

<style>
input {
font-family: 'Lucida Grande', Tahoma, Verdana, sans-serif;
font-size: 14px;
}

input[type=text], input[type=password] {
margin: 5px;
padding: 0 10px;
width: 200px;
height: 34px;
color: #404040;
background: white;
border: 1px solid;
border-color: #c4c4c4 #d1d1d1 #d4d4d4;
border-radius: 2px;
outline: 5px solid #eff4f7;
-moz-outline-radius: 3px; // Can we get this on WebKit please?
}

input[type=submit] {
padding: 0 18px;
height: 29px;
font-size: 12px;
font-weight: bold;
color: #527881;
text-shadow: 0 1px #e3f1f1;
background: #cde5ef;
border: 1px solid;
border-color: #b4ccce #b3c0c8 #9eb9c2;
border-radius: 16px;
outline: 0;
}

.lt-ie9 {
input[type=text], input[type=password] { line-height: 34px; }
}
</style>
<div id="templatemo_content">
<div class="content_bottom"></div>

<div id="main_column">

<div class="post_box">

{{ Form::open(array('', 'class'=>'form-signup','files' => true)) }}

<h2><a href="#">Please Login</a></h2>
<ul>
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
{{ Form::text('firstname', null, array('class'=>'input-block-level', 'placeholder'=>'First Name')) }}<br>
{{ Form::text('lastname', null, array('class'=>'input-block-level', 'placeholder'=>'Last Name')) }}<br>
{{ Form::text('email', null, array('class'=>'input-block-level', 'placeholder'=>'Email Address')) }}<br>
{{ Form::password('password', array('class'=>'input-block-level', 'placeholder'=>'Password')) }}<br>
{{ Form::password('password_confirmation', array('class'=>'input-block-level', 'placeholder'=>'Confirm Password')) }}<br>

{{ Form::submit('Register', array('class'=>'btn btn-large btn-primary btn-block'))}}<br>
{{ Form::close() }}

</div> <!-- end of a post -->

</div> <!-- end of main column -->

<div id="side_column">

<div class="ads_250_250">
<a href="http://www.flashmo.com" target="_blank" title="free flash template"><img src="<?php echo $url = asset('img/templatemo_ads_02.jpg'); ?&gt;" alt="free flash template" /></a>                </div>

<div class="cleaner_h30">&nbsp;</div>

<div class="side_column_section">

<div class="ads_125_125 right_padding_10">
<a href="#"><img src="<?php echo $url = asset('img/templatemo_ads.jpg'); ?&gt;" alt="image" /></a>
</div>

<div class="ads_125_125">
<a href="#"><img src="<?php echo $url = asset('img/templatemo_ads.jpg'); ?&gt;" alt="image" /></a>
</div>

</div>

<div class="cleaner_h30">&nbsp;</div>

<div class="side_column_section">

<h3>Archives</h3>
<ul>
<li><a href="#">Poltic News</a></li>
<li><a href="#">Bollywood News</a></li>
<li><a href="#">Hollywood News</a></li>
<li><a href="#">Latest News</a></li>

</ul>

</div>

<div class="cleaner_h30">&nbsp;</div>

<div class="side_column_section">

<h3>Recent Posts</h3>

</div>

</div> <!-- end of side column -->

<div class="cleaner"></div>
</div>

step:6 Create user Model in app model create User.php

<?php

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Eloquent implements UserInterface, RemindableInterface {

use UserTrait, RemindableTrait;

/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';

/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password', 'remember_token');

public static $rules = array(
'firstname'=>'required|alpha|min:2',
'lastname'=>'required|alpha|min:2',
'email'=>'required|email|unique:users',
'password'=>'required|alpha_num|between:6,12|confirmed',
'password_confirmation'=>'required|alpha_num|between:6,12'
);

}
?&gt;

register

login

Share Button

About admin

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Author: pramod kumar kumawat Mob: 9269727062
Free WordPress Themes - Download High-quality Templates