I just want to redirect to the route with param from controller can you please help me ?

Posted 1 month ago by tanveerkhanwd
//here is my UserController.php
public function Logininme(Request $request)
    {
        //$game_id = Game::where('user_id','=',$request->id)->orderBy('id','DESC')->first();
        $validator =Validator::make($request->all(), [
            'email' => 'required|email',
            'password' => 'required'
        ]);
        if ($validator->fails()) {
            return Response()->json(array('success' => false, 'errors' => $validator->messages()));
        }
        if (Auth::attempt(['email' => $request->email, 'password' => $request->password, 'status_ban'=>0]))
        {
            Session::put('profimg', Auth::user()->uprofiles->pimg);
                 return Response()->json(array('success' => 'success', 'errors' => 'fffff','route' => 'profile'));
        }
        else
        {
            return Response()->json(array('success' => 'loginfail', 'errors' => 'Email or Password is incorrect or your account banned by admin. '));
        }
        

    }

//Here is my angular code to redirect to the page :
$scope.loginme = function() {
        console.log($scope.login);
        httpService.signinme($scope.login).then(function (data) {
            $scope.loginretval = data.data;
            if(data.data.route=='profile')
          {
             window.location= 'profile';
          }
      });
    }

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.