I'm using ollieread multiauth. I got the problem when at route i try to use
Route::group(['before' => 'auth'], function()
{
Route::get('/onlinetest', array('as'=>'onlinetest', 'uses'=>'HomeController#onlinetest'));
Route::get('/quiz', array( 'as'=>'quiz', 'uses'=>'HomeController#quiz'));
Route::get('/number', array( 'as'=>'number', 'uses'=>'HomeController#number'));
Route::get('/word', array( 'as'=>'word', 'uses'=>'HomeController#word'));
});
Here is my usercontroller:
public function handlelogin()
{
$today = date("Y-m-d H:i:s");
$userdata = array(
'email' => Input::get('username'),
'password' => Input::get('password')
);
if (Auth::check())
{
return Redirect::to('/');
}
if(Auth::user()->attempt($userdata, true))
{
$user = User::find(Auth::user()->get()->id);
// check if user has use his account for test
if ($user->status == '0')
{
Auth::logout();
Session::flush();
return Redirect::to('/login')->with('message', FlashMessage::DisplayAlert('Your Account has been used for test', 'warning'));
}
$datebirth = Date($user->BirthDate);
$dob = Date("Y") - $datebirth;
Session::put('current_user', Input::get('username'));
Session::put('full_name', $user->FullName);
Session::put('gender', $user->Sex);
Session::put('dob', $dob);
Session::put('user_id', $user->id);
// set the user last login
$user->last_login = $today;
$user->save();
return Redirect::to('/onlinetest')->with('message', 'Login Successfully.');
}
else
{
return Redirect::to('/login')->with('message', FlashMessage::DisplayAlert('Incorrect Username / Password', 'danger'));
}
}
My Filter:
<?php
/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function($request)
{
//
});
App::after(function($request, $response)
{
//
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function()
{
if (Auth::guest())
{
if (Request::ajax())
{
return Response::make('Unauthorized', 401);
}
else
{
return Redirect::guest('login');
}
}
});
Route::filter('auth.basic', function()
{
return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/
Route::filter('guest', function()
{
if (Auth::check()) return Redirect::to('/');
});
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function()
{
if (Session::token() !== Input::get('_token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
});
apparently if I not using olliread this route is not working. I always can go to onlinetest even i'm not logging in.
Is there any solution for the route? or maybe I got it wrong at my controller?
Thanks.
You don't have a "user" filter which you specify in your Route group. Try swapping out "user" in your route group to "auth":
<?php
Route::group(['before' => 'auth'], function()
{
// ...
});
Related
I am experiencing this error when trying to navigate to "/admin". Other routes such as "/employee" are working fine.
Here are my current web routes
Auth::routes();
/* Voyager Routes */
Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
...
});
/* Badge App Routes - All the dashboard routes for managers, employees and HRs are defined here */
Route::group(['middleware' => 'auth', 'prefix' => 'employee'], function () {
Route::get('/', 'frontend\DashboardController#index')->name('homepage');
Route::get('dashboard', 'frontend\DashboardController#index')->name('homepage');
...
});
Route::group(['middleware' => 'auth'], function () {
Route::resource('team-manager', 'frontend\TeamManagerController');
Route::resource('badges', 'backend\BadgeController');
Route::get('badges/award/{id?}', 'backend\BadgeController#award');
Route::post('store_award', 'backend\BadgeController#storeAward')->name('store_award');
});
/* User Redirector - Based on user role */
Route::group(['middleware' => ['redirector']], function () {
Route::get('/');
Route::get('login');
});
And here's my middleware redirector
public function handle($request, Closure $next){
if (!Auth::guest()) {
$user = User::find(Auth::id());
// TODO: fix static id below
return $user->role_id == 1 ? redirect('admin') : redirect('employee');
}
return redirect(route('voyager.login'));
}
Thank you in advance!
The problem is in your middleware:
return $user->role_id == 1 ? redirect('admin') : redirect('employee');
You have admin role, and you are also in /admin page. Then your middleware redirects you again and again to /admin.
It is better to check if the user is not in the /admin or /admin/* related routes, then redirect him to admin.
if($user->role_id == 1) {
//check if user is in /admin or /admin related routes.
return ($request->is('/admin') or $request->is('/admin/*')) ? $next($request) : redirect('admin');
} else {
redirect('/employee');
}
I am adapting the out-of-the-box AuthController in Laravel 5.2 to suit my needs. I want to implement login form using AJAX. For that I write the code. But when I click on login button then show 302 error and redirect. I don't know what is my mistake.
My JS
function do_login()
{
frm_name = 'userlogin';
username = $('#userlogin input[id=email]').val();
password = $('#userlogin input[id=password]').val();
_token = $('#userlogin input[id=_token]').val();
if(username == '' || password == '') {
$('#flashMessage').attr('class','alert alert-danger');
$('#flashMessage').html('Please specify Username and Password');
} else {
var param = 'username='+ username+ '&password='+ password +'&_token='+ _token;
$.ajax({
type : "POST",
datatype : "json",
url: "auth/login",
data : param,
success : function(data) {
data = JSON.parse(data);
if (data.status == 0) {
$('#myModallogin').modal('hide');
window.location.href = data.redirect_url;
}
if (data.status == 1) {
$('#flashMessage').attr('class','alert alert-danger');
$('#flashMessage').html(data.message);
} else {
onError(data.Error,'#'+ frm_name);
}
}
});
}
}
$(document).ready(function(){
$('#member_login').click(function() {
do_login();
});
});
My route
Route::auth();
Route::post('auth/login', 'Auth\AuthController#userLogin');
My AuthController
class AuthController extends Controller
{
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
/**
* Where to redirect users after login / registration.
*
* #var string
*/
//protected $redirectTo = '/';
/**
* Create a new authentication controller instance.
*
* #return void
*/
public function __construct() {
$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
}
public function userLogin() {
$post_data = Request::all();
pr($post_data);exit;
}
}
My route is working properly because when I debug the routes for example Route::post('auth/login', function(){ echo 'aaaaaaaaaa'; }); so it display the aaaaaa. But when I called the function then show 302 error and redirect the page. I don't know what is my mistake. Please suggest me.
I have this in my database
|username|password|type|
------------------------
|foo |12345 |1 |
|asd |adsdsd |0 |
Here 1 means that the user is an admin, 0 a normal user.
How can I redirect the admin to the admin page and the normal user to normal user page??
if($attempt)
{
$id = User::find($attempt);
$user = $id->type;
if($user === 0)
{
return Redirect::action('LoginUsersController#profile');
}
else
{
return Redirect::to('adminpage');
}
}
I created this in my UsersController page I don’t know if this is the proper way to do this, and my code is not working.
Are you using normal Laravel Authentication?
You will get Object Auth::user(), this will return current user Object.
It should look like this.
Controller (SessionsController#store)
public function store() {
$input = Input::all();
$attempt = Auth::attempt([
'username' => $input['username'],
'password' => $input['password']
]);
if($attempt) {
if(Auth::user()->type == 1) {
return Redirect::admin(); // If admin, redirect to admin
} else {
return Redirect::profile(); // Else, redirect to user profile
}
}
}
Route
Route::resource('sessions', 'SessionsController', ['only' => ['create','store','destroy']]);
Route::get('admin', 'AdminController#dashboard')->before('adminAuth');
Route::get('profile/{id}', 'UsersController#showProfile')->before('auth');
First of all you have to add a new field in your users table to check against, for example 'rank'. If rank for a user is '1' so he is an Admin,
else he is a normal user.
Then define all required routes in your routes file like this:
Route::get('login', 'adminController#login');
Route::post('login', 'adminController#checkuser');
Route::group(array('before' => 'auth'), function() {
Route::resource('admin', 'adminController');
Route::resource('normaluser', 'normaluserController');
} );
Then in your controller you have to define all actions:
public function login()
{
return View::make('loginview');
}
public function checkuser()
{
if (Auth::attempt(array('username'=>Input::get('username'), 'password'=>Input::get('password'))))
{
$user_data = Auth::getUser();
if ($user_data->rank == 1) //if true, so this user is an admin
{return Redirect::to('admin');} //go to adminController index action
else //if not, so he is a normal user
{return Redirect::to('normaluser');} // go to normaluserController index action
}
else
{
//return 'wrong user name or password';
Session::flash('mismatch', "Username and Password mismatch");
return Redirect::to('login'); // go again to login form to relogin
}
}
if any thing is not clear, don't hesitate to ask.
in the if statement use:
if($attempt)
{
$id = User::find($attempt);
$user = $id->type;
if($user === 0)
{
return Redirect::action('LoginUsersController#profile');
header('Location: http://www.example.com/userpahe.php');
}
else
{
return Redirect::to('adminpage');
header('Location: http://www.example.com/admin-page.php');
}
}
I am currently getting a white screen of death when I am trying to redirect my users using the Laravel Redirect class after handling data. If I use the native php-function header("location ...") the application responds correctly and sends the user on its merry way, but using Laravel's Redirect class the site crashes with a white screen of death. I have tried both the Redirect::action and Redirect::to functions, but they are both resulting in the same irritating white screen of death. The laravel.log shows nothing...
Does anyone have any ideas?
Here is the code for the data handler controller class:
<?php
class ManagerLayoutDataController extends BaseController
{
public function route($action, $moduleID) {
if(method_exists('ManagerLayoutDataController',$action)) {
$this->$action($moduleID);
}
// Invalid action (method not found)
else {
die('Action routing error');
//return Redirect::to('/');
}
}
public function updateHeaderBg($moduleID) {
$image = Input::file('img');
$user = Auth::user();
$siteID = $user->getSiteID();
$layoutDataMessage = null;
// Validate file upload (NOT FILE CHARACTERISTICS)
if(Input::hasFile('img') && $image->isValid() && isset($siteID) && $siteID !== "") {
$res = ManagerFileUpload::uploadImage($siteID, $image);
if($res->success) {
$fileName = $res->fileName;
$dbViewModule = ViewModuleRepository::getModule($moduleID);
if($dbViewModule->type === DBViewModule::MODULE_TYPE_HEADER) {
$headerModule = new HeaderModule($dbViewModule);
$headerModule->updateBgImage($fileName);
$layoutDataMessage = new LayoutDataMessage(LayoutDataMessage::STATUS_SUCCESS,"");
}
}
else {
$layoutDataMessage = new LayoutDataMessage(LayoutDataMessage::STATUS_FAIL,$res->message);
}
}
else {
$layoutDataMessage = new LayoutDataMessage(LayoutDataMessage::STATUS_FAIL, "Bilden kunde inte laddas upp.");
}
if($layoutDataMessage != null) {
return Redirect::action('ManagerLayoutController#main')->with('message',$layoutDataMessage);
//return Redirect::to('manager/layout/');
//header('location: */manager/layout');
}
else {
return Redirect::action('ManagerLayoutController#main')->with('message',LayoutDataMessage(LayoutDataMessage::STATUS_FAIL, "Bilden kunde inte laddas upp."));
//return Redirect::to('manager/layout/');
//header('location: */manager/layout');
}
}
}
The Main Controller
<?php
class ManagerLayoutController extends BaseController
{
public function main() {
$user = Auth::user();
$siteID = $user->getSiteID();
$moduleComposition = ViewModuleCompositionRepository::getCurrentInWorkModuleComposition($siteID);
$dbViewModules = ViewModuleRepository::getModulesFromComposition($moduleComposition->id);
$viewModules = array();
foreach($dbViewModules as $dbViewModule) {
switch($dbViewModule->getType()) {
case DBViewModule::MODULE_TYPE_HEADER:
$viewModules[] = new HeaderModule($dbViewModule);
break;
case DBViewModule::MODULE_TYPE_TEXT_SECTION:
$viewModules[] = new TextSectionModule($dbViewModule);
break;
case DBViewModule::MODULE_TYPE_KEY_METRICS:
$viewModules[] = new KeyMetricsModule($dbViewModule);
break;
case DBViewModule::MODULE_TYPE_SLIDESHOW:
$viewModules[] = new SlideShowModule($dbViewModule);
break;
case DBViewModule::MODULE_TYPE_VACANCIES:
$viewModules[] = new VacanciesModule($dbViewModule);
break;
case DBViewModule::MODULE_TYPE_EMAIL_SUBSCRIPTION:
$viewModules[] = new EmailSubscriptionsModule($dbViewModule);
break;
case DBViewModule::MODULE_TYPE_CO_WORKERS:
$viewModules[] = new CoworkersModule($dbViewModule);
break;
case DBViewModule::MODULE_TYPE_NEWS_SECTION:
$viewModules[] = new NewsModule($dbViewModule);
break;
case DBViewModule::MODULE_TYPE_INSTAGRAM_FEED:
$viewModules[] = new KeyMetricsModule($dbViewModule);
break;
case DBViewModule::MODULE_TYPE_SOCIAL_MEDIA:
$viewModules[] = new KeyMetricsModule($dbViewModule);
break;
}
}
$data = array(
'siteID' => $siteID,
'viewModules' => $viewModules
);
return View::make('dashboard.pages.manager.layout_main',$data);
}
}
filters.php
<?php
/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function($request)
{
//
});
App::after(function($request, $response)
{
//
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function()
{
if (Auth::guest())
{
if (Request::ajax())
{
return Response::make('Unauthorized', 401);
}
else
{
return Redirect::guest('login');
}
}
});
Route::filter('auth.basic', function()
{
return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/
Route::filter('guest', function()
{
if (Auth::check()) return Redirect::to('/');
});
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function()
{
if (Session::token() != Input::get('_token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
});
/** Admin pages */
Entrust::routeNeedsRole( 'admin*', 'Admin', Redirect::to('/login'));
/** Manage pages */
Entrust::routeNeedsRole( 'manager*', array('Super Manager','Manager'), Redirect::to('/login'), false );
/**
* Check view module ownership before editing data
*/
Route::filter('viewmodule.ownership', function($route) {
$user = Auth::user();
$siteID = $user->getSiteID();
$moduleID = $route->getParameter('moduleID');
// Check that the module with $moduleID belongs to $siteID
if(ViewModuleRepository::moduleBelongToSite($moduleID, $siteID)) {
}
// Unauthorized access
else {
die('Filter error');
//Redirect::to('/');
}
});
routes.php
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', 'FrontController#main');
Route::get('/manager', 'ManagerHomeController#home');
Route::get('/manager/statistics', 'ManagerStatisticsController#main');
Route::get('/manager/resume-manager', 'ManagerResumeController#main');
Route::get('/manager/resume-manager/pending', 'ManagerResumeController#resumesPending');
Route::get('/manager/resume-manager/approved', 'ManagerResumeController#resumesApproved');
Route::get('/manager/resume-manager/rejected', 'ManagerResumeController#resumesRejected');
Route::get('/manager/layout', 'ManagerLayoutController#main');
Route::get('/manager/layout-old', 'OLDManagerLayoutController#main');
Route::post('/manager/layout/data/{action}/{moduleID}/', array('before'=>'viewmodule.ownership', 'uses' => 'ManagerLayoutDataController#route'));
Route::get('/manager/setup', 'ManagerSetupController#setup');
Route::get('/admin', 'AdminHomeController#home');
Route::get('/login', 'UsersController#login');
Route::get('/test', 'TestController#testMail');
// Confide routes
Route::get('users/create', 'UsersController#create');
Route::post('users', 'UsersController#store');
Route::get('users/login', 'UsersController#login');
Route::post('users/login', 'UsersController#doLogin');
Route::get('users/confirm/{code}', 'UsersController#confirm');
Route::get('users/forgot_password', 'UsersController#forgotPassword');
Route::post('users/forgot_password', 'UsersController#doForgotPassword');
Route::get('users/reset_password/{token}', 'UsersController#resetPassword');
Route::post('users/reset_password', 'UsersController#doResetPassword');
Route::get('users/logout', 'UsersController#logout');
Try to add
ini_set('display_errors', 1);
It should at least tell you what is the actual error.
This is only for development mode, remove it when you go into production
Look if there is a "return" before the Redirect. For example:
// Unauthorized access
else {
die('Filter error');
//Redirect::to('/');
}
Here should be return Redirect::to('/');
So I have been trying to use the "put" method in my routing, I have followed this example directly from the "routes.php" file:
Route::put('hello/(:any)', function($name)
{
return "Welcome, $name.";
});
This returns a 404 error, I really want my code to look like below. I want to be able to take to parameters from the url and use them for verification, later on I plan to use an encoding method but for now I just wanted to get the routes working properly before I tried encoding them. Any help would be greatly appreciated!!!
Route::put('admin/activate/(:any?)/(:any?)', function($r, $e) {
return "Random value: $r <br/> Email: $e";
});
You can find the page here: http://diverseevolution.com/admin/activate/randomstring/test#gmail.com
Here is my overall "routes.php" file:
Route::get('/', function() {
return View::make('homepage.index');
});
///////////////////////////////////////////////////////////////////////////////////////////
/////////////// Administration Account Creation & Login /////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Create account
Route::get('admin/createform', function() {
return View::make('admin.createform');
});
// action for actual admin creation
Route::post('admin/create', array('before' => 'csrf', function() {
$rules = array(
'fname' => 'required|min:3',
'lname' => 'required|min:3',
'email' => 'required|email|unique:users',
'pword' => 'required'
);
$validated = Validator::make(Input::all(), $rules);
if($validated -> fails()) {
return Redirect::to('admin/createform')->with_input();
} else {
$r = Hash::make(time() .'ReAl19dk4-^4$'. $_POST['pword']);
$user = new User;
$user -> fname = $_POST['fname'];
$user -> lname = $_POST['lname'];
$user -> email = $_POST['email'];
$user -> pword = Hash::make($_POST['pword']);
$user -> status = 'unactivated';
$user -> random = $r;
if($user -> save()) {
//////////////////////// Email /////////////////////////////////
// We still need to make this functionality
$msg = '
<h1>Your admin account has been created!</h1>
<p>Congratulations on creating your new account, there is one last step before your account can be activated. Below is a link, simply follow the link to activate your account, once you have your account will be active and you will be able to login!</p>
<p>http://diverseevolution.com/admin/activate/'. $r .'/'. $_POST['email'] .'</p>
<p>Thanks, Diverse Evolution</p>
';
// Mail headers
$headers = "Reply-To: Diverse Evolution <info#diverseevolution.com>\r\n";
$headers .= "Return-Path: Diverse Evolution <info#diverseevolution.com>\r\n";
$headers .= "From: Diverse Evolution <info#diverseevolution.com>\r\n";
$headers .= "Organization: Diverse Evolution\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP". phpversion() ."\r\n";
define('_headers', $headers);
if(mail($_POST['email'], 'Diverse Evolution Account Created', $msg, _headers)) {
return Redirect::to('admin/thanks');
} else {
}
} else {
return Redirect::to('admin/createform')->with_input();
}
}
}));
// creates the thank you page for the admin account creation
Route::get('admin/thanks', function() {
return View::make('admin/thanks');
});
// account activation email, this is still not working 011613
Route::put('admin/activate/(:any?)/(:any?)', function($r, $e) {
return "Random value: $r <br/> Email: $e";
});
// Login form
Route::get('admin/loginform', function() {
return View::make('admin/loginform');
});
// Login action
Route::post('admin/login', array('before' => 'csrf', function() {
$rules = array(
'email' => 'required|email',
'pword' => 'required'
);
$validated = Validator::make(Input::all(), $rules);
if($validated -> fails()) {
return Redirect::to('admin/loginform')->with_input();
} else {
$credentials = array('username' => $_POST['email'], 'password' => $_POST['pword']);
if (Auth::attempt($credentials)) {
return Redirect::to('admin/dash');
} else {
return Redirect::to('admin/loginform')->with_input();
}
}
}));
Route::get('admin/logout', function() {
Auth::logout();
return Redirect::to('admin/loginform');
});
///////////////////////////////////////////////////////////////////////////////////////////
/////////////////////// Administration Pages ////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
Route::group(array('before' => 'auth'), function() {
Route::get('admin/dash', function() {
return 'Dashboard';
});
});
/*
|--------------------------------------------------------------------------
| Application 404 & 500 Error Handlers
|--------------------------------------------------------------------------
|
| To centralize and simplify 404 handling, Laravel uses an awesome event
| system to retrieve the response. Feel free to modify this function to
| your tastes and the needs of your application.
|
| Similarly, we use an event to handle the display of 500 level errors
| within the application. These errors are fired when there is an
| uncaught exception thrown in the application.
|
*/
Event::listen('404', function()
{
return Response::error('404');
});
Event::listen('500', function()
{
return Response::error('500');
});
/*
|--------------------------------------------------------------------------
| Route Filters
|--------------------------------------------------------------------------
|
| Filters provide a convenient method for attaching functionality to your
| routes. The built-in before and after filters are called before and
| after every request to your application, and you may even create
| other filters that can be attached to individual routes.
|
| Let's walk through an example...
|
| First, define a filter:
|
| Route::filter('filter', function()
| {
| return 'Filtered!';
| });
|
| Next, attach the filter to a route:
|
| Route::get('/', array('before' => 'filter', function()
| {
| return 'Hello World!';
| }));
|
*/
Route::filter('before', function()
{
// Do stuff before every request to your application...
});
Route::filter('after', function($response)
{
// Do stuff after every request to your application...
});
Route::filter('csrf', function()
{
if (Request::forged()) return Response::error('500');
});
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::to('admin/loginform');
});
You didnt include your form - but I'm guessing you didnt include a "PUT" in the form.
echo Form::open('user/profile', 'PUT');
You can see more about forms and PUT here. But in general, you need to specifically include PUT in your form, otherwise it will just be POST (browser default).
Using GET works?
or
Route::put('hello/(:all)', function($name)
{
return "Welcome, $name.";
});
all becouse #