更新:
当我在Laravel 4工作时,我的退出操作有问题,但是在laravel 4.1中我有这个错误:
Missing argument 2 for Illuminate\Database\Eloquent\Model::setAttribute(),
called in
C:\Users\mohammed\workspace\mylittlebiz\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php on line 2432 and defined
Run Code Online (Sandbox Code Playgroud)
这是我的行动:
public function doLogout()
{
Auth::logout(); // log the user out of our application
return Redirect::to('login'); // redirect the user to the login screen
}
Run Code Online (Sandbox Code Playgroud)
这是我的模特:
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
class User extends Eloquent implements UserInterface, RemindableInterface {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
protected $hidden = array('password');
/**
* Get …Run Code Online (Sandbox Code Playgroud) 所以我正在做的是,当我选中“记住我”复选框时,用户在注销表单(用户名和密码)时会记住这样的用户数据:
所以这是我的代码它不起作用:(
// create our user data for the authentication
$userdata = array(
'email' => Input::get('email'),
'password' => Input::get('password')
);
// attempt to do the login
if (Auth::attempt($userdata, true)) {
Session::flash('message', array('body'=>trans('login-signup.welcome'), 'type'=>'success'));
return Redirect::to('/');
}
Run Code Online (Sandbox Code Playgroud) 所以我在asp.net mvc 4项目工作,我在我的视图中有一个问题,我想要的是创建一个具有2种不同类型的模型的视图,第一个视图(索引)采用IEnumerable(Models.myModel)第二个(订阅者详细信息) )拿Models.myModel,这是我的Model代码:
public class SubscribersModel
{
[Required]
[DataType(DataType.Text)]
public string name { get; set; }
[Required]
[DataType(DataType.Text)]
[StringLength(maximumLength: 10, MinimumLength = 7)]
public string cin { get; set; }
[Required]
[DataType(DataType.Date)]
public DateTime birthday { get; set; }
[DataType(DataType.Text)]
public string birthplace { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我的控制器代码:
public class SubscribersController : Controller
{
private AgencyDbEntities dbcontext = new AgencyDbEntities();
private Subscribe sb = new Subscribe();
public ActionResult Index()
{
var subscribers = from sb in dbcontext.Subscribes …Run Code Online (Sandbox Code Playgroud)