Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hash::make not working in laravel 5.0 Controller

I new on laravel 5.0 see error http://i.stack.imgur.com/4ZMgZ.png Here is my controller code

<?php namespace App\Http\Controllers;
use Illuminate\Support\Facades\Input;
class DealerController extends Controller {

    public function __construct(){
        //$this->middleware('auth');
    }

    public function login(){
        return view('login');
    }

    public function index() {
        return view('login');

    }
    public function login_auth(){
        $dealer_loginname = Input::get('dealer_loginname');
        $dealer_password = Input::get('dealer_password');
        $dealer_hashed_pass = Hash::make($dealer_password);

    }
}

I Hash::make works fine in composer cmd http://i.stack.imgur.com/SqdYs.jpg and its also work on routes file

//Route::post('dealerpanel/login_auth','DealerController@login_auth');
Route::post('dealerpanel/login_auth',function (){
    $pass = Hash::make('abc');
    die($pass);
    //$2y$10$lSG0Dl3NCJ0ubWIwILzPk.SFGeLmwkw03v3NZ5yMgkg4fAry1Cjc2
});
like image 646
user3151197 Avatar asked Feb 20 '15 06:02

user3151197


1 Answers

seems like you didn't import Hash since your using namespaces.

try to add

use Hash;

on top of the DealerController file like,

<?php namespace App\Http\Controllers;

    use Illuminate\Support\Facades\Input;
    use Hash;

    class DealerController extends Controller {

    public function __construct(){....

or just use

$pass = \Hash::make('abc');
like image 98
Kalhan.Toress Avatar answered Sep 26 '22 09:09

Kalhan.Toress