snail

6148 经验值

既然没办法克服就当废物好了

public function index($category_id =0)
    {
        $articles =  Article::with('getCategory')->where('category_id',$category_id)->paginate(1);
        return $this->paginator($articles, new ArticleTransformer(), function ($resource, $fractal) {
            $fractal->setSerializer(new ArticleSerializer());
        });
    }
//加入ThrottlesLogins
use Illuminate\Foundation\Auth\ThrottlesLogins;

//控制器方法类
try {

    /*
    * 检测用户是否尝试登录次数过多
    */
    if ($throttles && $this->hasTooManyLoginAttempts($request)) {
        return $this->sendLockoutResponse($request);
    }


    if (!Auth::attempt(['phone_mobile' => Input::get('username'), 'password' => Input::get('password')], false)) {
        throw new \Exception('您输入的帐号或者密码不正确!');
    }

    if ($throttles) {
        $this->clearLoginAttempts($request);
    }

} catch (\Exception $e) {

    if ($throttles) {
        $this->incrementLoginAttempts($request);
    }
}

这个也期待, 一直没搞懂单元测试,感觉不是很适用!可能自己理解的不够!

数据库连接满了,等等~

个人不喜欢laravel自带的登录逻辑,全部重写