I am absolutly new in PHP and in Laravel .
I am working on a Laravel controller class and I have put these 2 line
Console::info('username: ' + $userName); Console::info('password ' + $pswd);
to log what happens in the code.
So my entire controller class is:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Input;
use function GuzzleHttp\json_encode;
use function GuzzleHttp\json_decode;
use Illuminate\Support\Facades\Artisan;
class LoginBetriviusController extends Controller
{
//------------------------------------------------------------------------------------
//metodo richiamato al caricamento della web application - carica la pagina principale
//------------------------------------------------------------------------------------
public function index(){
return view('login');
}
//------------------------------------------------------------------------------------
//TODO _ implementare chiamata per la LOGIN
//------------------------------------------------------------------------------------
public function doLogin(){
$userName = Input::get('username');
$pswd = Input::get('password');
Console::info('username: ' + $userName);
Console::info('password ' + $pswd);
return view('dashboard-hotel');
}
//------------------------------------------------------------------------------------
//FINE --- implementare chiamata per la LOGIN
//------------------------------------------------------------------------------------
}
the prolem is that when enter in this method I am obtaining the following error message when try to execute the first Console::info method:
[Mon Jan 23 17:48:46 2017] PHP Fatal error: Class 'App\Http\Controllers\Console' not found in C:\Users\Andrea\Documents\Betrivius
\WorkSpace\betriviusExtranet\app\Http\Controllers\LoginBetriviusController.php on line 34
Why? What am I missing? How can I fix this issue?
Use Log facade:
\Log::info('username: '.$userName);
\Log::info('password '.$pswd);
You have to use the Log facade.
Namespace it with use Illuminate\\Support\\Facades\\Log;
and simply call Log::info('My log data');
Although I strongly discourage storing password data and especially in plain text!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.