// Route::filter('auth.basic', function() // { // return Auth::basic(); // }); /* |-------------------------------------------------------------------------- | Guest Filter |-------------------------------------------------------------------------- | | The "guest" filter is the counterpart of the authentication filters as | it simply checks that the current user is not logged in. A redirect | response will be issued if they are, which you may freely change. | */ Route::filter('guest', function () { if (UserAuthController::isLogin()) { return Redirect::to('/'); } }); /* |-------------------------------------------------------------------------- | CSRF Protection Filter |-------------------------------------------------------------------------- | | The CSRF filter is responsible for protecting your application against | cross-site request forgery attacks. If this special token in a user | session does not match the one given in this request, we'll bail. | */ Route::filter('csrf', function () { if (Session::token() != Input::get('_token')) {
public function switchLike($ablum_id, $likeit) { $user_id = UserAuthController::getLoginUserid(); if (1 == $likeit) { // like it tb_like::firstOrCreate(array('user_id' => $user_id, 'ablum_id' => $ablum_id)); } else { tb_like::where('user_id', $user_id)->where('ablum_id', $ablum_id)->delete(); } $items = array('likes' => self::getLikesOfAblum($ablum_id), 'likeit' => self::isLikeIt($ablum_id, $user_id)); return Response::json(array('status' => 1, 'msg' => 'success', 'data' => $items)); }