, поэтому я использую laravel 4.2. моя проблема в том, что я не могу повторить данные из моего маршрута перенаправления. как я могу получить к нему доступ правильно? Я попытался найти правильный ответ, но мне это не помогло.Не удается получить доступ к данным, переданным при перенаправлении
public function postLogin()
{
$timeIn = date('Y-m-d G:i:s');
$userLog = New UserLog;
$userLog->username = Input::get('username');
$userLog->time_in = $timeIn;
$userLog->save();
$users = $userLog;
return Redirect::route('account')
->with('users', $users);
}
public function account(){
$data = Session::get('users');
var_dump($data);
echo $data->username;// this one throws an error
}
Я вижу, что он имеет значения в var_dump ($ data).
object(__PHP_Incomplete_Class)[92]
public '__PHP_Incomplete_Class_Name' => string 'UserLog' (length=7)
public 'timestamps' => boolean false
public 'table' => string 'userlogs' (length=8)
protected 'connection' => null
protected 'primaryKey' => string 'id' (length=2)
protected 'perPage' => int 15
public 'incrementing' => boolean true
protected 'attributes' =>
array (size=3)
'username' => string 'user' (length=4)
'time_in' => string '2015-07-28 15:11:43' (length=19)
'id' => int 240
protected 'original' =>
array (size=3)
'username' => string 'user' (length=4)
'time_in' => string '2015-07-28 15:11:43' (length=19)
'id' => int 240
это мои маршруты файл
Route::get('/login', array(
'uses' => '[email protected]',
'as' => 'login')
);
Route::post('/postLogin', array(
'uses' => '[email protected]',
'as' => 'postLogin')
);
Route::get('/account', array(
'uses' => '[email protected]',
'as' => 'account')
);