Laravel 4 Don';t显示URL';Laravel 4.1中的s参数
我在Laravel 4.1中为用户提供了CRUD 当用户想要查看其数据时,url为:mydomain.com/public/users/3(show方法) 如何在url中隐藏id“3”?那么,如果数字可见,用户可以看到其他用户的数据(如4,5或其他id) 谢谢 在my filter.php中,我有:Laravel 4 Don';t显示URL';Laravel 4.1中的s参数,laravel-4,Laravel 4,我在Laravel 4.1中为用户提供了CRUD 当用户想要查看其数据时,url为:mydomain.com/public/users/3(show方法) 如何在url中隐藏id“3”?那么,如果数字可见,用户可以看到其他用户的数据(如4,5或其他id) 谢谢 在my filter.php中,我有: Route::group(array('before' => 'auth'), function() { Route::resource('users', 'UserContro
Route::group(array('before' => 'auth'), function()
{
Route::resource('users', 'UserController');
});
终于解决了
在UserController.php中:
public function show()
{
//
$usuario = Auth::user();
// show the view and pass the nerd to it
return View::make('users.show')
->with('elusuario', $usuario);
}
在show.blade.php中
@extends ("layout/layout")
@section ("principal")
<div class="form-group">
{{ Form::label('nombre', 'Nombre') }}
{{ Form::text('nombre',null, array('class' => 'form-control','placeholder'=>$elusuario->nombre,'disabled'=>'disabled')) }}
</div>
<div class="form-group">
{{ Form::label('email', 'Email') }}
{{ Form::email('email',null, array('class' => 'form-control','placeholder'=>$elusuario->email,'disabled'=>'disabled')) }}
</div>
<a class="btn btn-success" href="{{ URL::to('users/' . $elusuario->id . '/edit') }}">Modificar datos</a>
@stop
@扩展(“布局/布局”)
@第节(“委托人”)
{{Form::label('nombre','nombre')}
{Form::text('nombre',null,array('class'=>'Form control','placeholder'=>$elusuario->nombre,'disabled'=>'disabled'))}
{{Form::label('email','email')}
{Form::email('email',null,数组('class'=>'Form control','placeholder'=>$elusuario->email,'disabled'=>'disabled'))}
@停止
这解决了问题,url不显示用户id。简单地称为mydomain.com/public/users/perfil,并具有来自会话变量的数据(id、名称等)。您可以定义一个筛选器,只有登录的用户才能调用此路由。我该如何做?我想这就是我问题的解决方案:那么,删除此问题;-)不需要删除这个问题,你也可以把你的解决方案作为答案发布。