public function store(Request $request)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            'email' => 'required|email',
            'name' => 'max:36',
        ]);
        $invitedMember = $this->createInvitedMember($request);
        $memberInvitation = $this->createMemberInvitation($request->email, $invitedMember->id);
        $invitedMember->notify(new MemberInvited($memberInvitation));
        /** @noinspection PhpUndefinedMethodInspection */
        return fractal($memberInvitation, new MemberInvitationTransformer())
            ->includeInvitedMember()
            ->withResourceName('memberInvitation')
            ->respond();
    }
public function store(Request $request)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            'email' => 'required|email',
            'name' => 'max:36',
        ]);
        $invitedMember = $this->createInvitedMember($request);
        $memberInvitation = $this->createMemberInvitation($request->email, $invitedMember->id);
        $invitedMember->notify(new MemberInvited($memberInvitation));
        /** @noinspection PhpUndefinedMethodInspection */
        return fractal($memberInvitation, new MemberInvitationTransformer())
            ->includeInvitedMember()
            ->withResourceName('memberInvitation')
            ->respond();
    }
public function store ( Request $ request ) { /** @noinspection PhpUndefinedMethodInspection */ $ request -> validate ( [ 'email' => 'required|email' , 'name' => 'max:36' , ] ) ; $ invitedMember = $ this -> createInvitedMember ( $ request ) ; $ memberInvitation = $ this -> createMemberInvitation ( $ request -> email , $ invitedMember -> id ) ; $ invitedMember -> notify ( new MemberInvited ( $ memberInvitation ) ) ; /** @noinspection PhpUndefinedMethodInspection */ return fractal ( $ memberInvitation , new MemberInvitationTransformer ( ) ) -> includeInvitedMember ( ) -> withResourceName ( 'memberInvitation' ) -> respond ( ) ; }
Invite a new Member; creates User if none exists; creates Member

@param  \Illuminate\Http\Request $request
@return \Illuminate\Http\Response JSON object with newly created Member
Invite a new Member ; creates User if none exists ; creates Member