public function getInvitation($code)
    {
        $model = config('auth.model');

        $model = get_class((new $model)->invitations()
                    ->getQuery()->getModel());

        $invitation = (new $model)->with('team.owner')
                    ->where('token', $code)->firstOrFail();

        if ($invitation->isExpired()) {
            $invitation->delete();

            abort(404);
        }

        $invitation->team->setVisible(['name', 'owner']);

        $invitation->team->owner->setVisible(['name']);

        return $invitation;
    }
public function getInvitation($code)
    {
        $model = config('auth.model');

        $model = get_class((new $model)->invitations()
                    ->getQuery()->getModel());

        $invitation = (new $model)->with('team.owner')
                    ->where('token', $code)->firstOrFail();

        if ($invitation->isExpired()) {
            $invitation->delete();

            abort(404);
        }

        $invitation->team->setVisible(['name', 'owner']);

        $invitation->team->owner->setVisible(['name']);

        return $invitation;
    }
public function getInvitation ( $ code ) { $ model = config ( 'auth.model' ) ; $ model = get_class ( ( new $ model ) -> invitations ( ) -> getQuery ( ) -> getModel ( ) ) ; $ invitation = ( new $ model ) -> with ( 'team.owner' ) -> where ( 'token' , $ code ) -> firstOrFail ( ) ; if ( $ invitation -> isExpired ( ) ) { $ invitation -> delete ( ) ; abort ( 404 ) ; } $ invitation -> team -> setVisible ( [ 'name' , 'owner' ] ) ; $ invitation -> team -> owner -> setVisible ( [ 'name' ] ) ; return $ invitation ; }
Get the invitation for the given code.

User to display coupon during registration.

@param  string  $code
@return \Illuminate\Http\Response
Get the invitation for the given code .