خرید بک لینک

Vote count: 0

I am trying to implement dingo API with laravel 5.2

Following is a function which I have written for testing dingo

public function profile()
{
    try {
        $user = JWTAuth::parseToken()->toUser();
        if (!$user) {
            retu response()->json(['error' => 'User Not Found'], 500);
        }
    } catch (TymonJWTAuthExceptionsJWTException $ex) {
        retu response()->json(['error' => 'Something went wrong'], 500);
    }
    //retu response()->json(['user' => $user->with('profile')->where('id', $user->id)->first()], 200);
    retu $this->response->array($user->toArray());

}

It works fine when I use

    retu response()->json(['user' => $user], 200);

But when I use following line of code in accordance with dingo syntax. It shows error

    retu $this->response->array($user->toArray());

Basically none of the dingo defined functions work. How can this be resolved?

asked 4 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 7 ارديبهشت 1395 ساعت: 15:06

صفحه بندی