User.php
<?php namespace Larabook;
use Larabook\User;
use Illuminate\Auth\UserTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Contracts\Auth\User as UserContract;
use Illuminate\Contracts\Auth\Remindable as RemindableContract;
class User extends Model implements UserContract, RemindableContract {
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 = ['password', 'remember_token'];
protected $fillable = ['email','password','phone','current_location','dob'];
}
/_____________________________ RegisterController.php ------------------------------>
<?php namespace Larabook\Http\Controllers;
use Illuminate\Routing\Controller;
class RegisterController extends Controller {
/**
* Display a listing of the resource.
* GET /register
*
* @return Response
*/
public function index()
{
return 'that a great';
}
/**
* Show the form for creating a new resource.
* GET /register/create
*
* @return Response
*/
public function create()
{
return view('register.create');
}
public function store(){
// enter a code here
$user = User::create(
Input::only('email','password','phone','current_location','dob')
);
Auth::login($user);
return redirect('/thanksyou');
}
}
/-------------------------RouteServiceProvider.php ---------------------->
<?php namespace Larabook\Providers;
use Illuminate\Routing\Router;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Routing\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider {
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*
* @param Router $router
* @param UrlGenerator $url
* @return void
*/
public function before(Router $router, UrlGenerator $url)
{
$url->setRootControllerNamespace('Larabook\Http\Controllers');
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
// Once the application has booted, we will include the default routes
// file. This "namespace" helper will load the routes file within a
// route group which automatically sets the controller namespace.
$this->app->booted(function()
{
$this->namespaced('Larabook\Http\Controllers', function(Router $router)
{
require app_path().'/Http/routes.php';
});
});
}
}