public function store(Request $request)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            "memberId" => "exists:" . config('combine-core.tablePrefix', 'combine') . "_members,id",
            "memberTagId" => "exists:" . config('combine-core.tablePrefix', 'combine') . "_member_tags,id",
        ]);
        $memberTag = MemberTag::findOrFail($request->memberTagId);
        $this->authorize('attachMember', [$memberTag, $request->memberId]);
        /** @noinspection PhpUndefinedMethodInspection */
        $memberTag->members()->attach($request->memberId);
        return fractal($memberTag, new MemberTagTransformer())
            ->withResourceName('memberMemberTag')
            ->respond();
    }
public function store(Request $request)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            "memberId" => "exists:" . config('combine-core.tablePrefix', 'combine') . "_members,id",
            "memberTagId" => "exists:" . config('combine-core.tablePrefix', 'combine') . "_member_tags,id",
        ]);
        $memberTag = MemberTag::findOrFail($request->memberTagId);
        $this->authorize('attachMember', [$memberTag, $request->memberId]);
        /** @noinspection PhpUndefinedMethodInspection */
        $memberTag->members()->attach($request->memberId);
        return fractal($memberTag, new MemberTagTransformer())
            ->withResourceName('memberMemberTag')
            ->respond();
    }
public function store ( Request $ request ) { /** @noinspection PhpUndefinedMethodInspection */ $ request -> validate ( [ "memberId" => "exists:" . config ( 'combine-core.tablePrefix' , 'combine' ) . "_members,id" , "memberTagId" => "exists:" . config ( 'combine-core.tablePrefix' , 'combine' ) . "_member_tags,id" , ] ) ; $ memberTag = MemberTag :: findOrFail ( $ request -> memberTagId ) ; $ this -> authorize ( 'attachMember' , [ $ memberTag , $ request -> memberId ] ) ; /** @noinspection PhpUndefinedMethodInspection */ $ memberTag -> members ( ) -> attach ( $ request -> memberId ) ; return fractal ( $ memberTag , new MemberTagTransformer ( ) ) -> withResourceName ( 'memberMemberTag' ) -> respond ( ) ; }
Add an MemberTag to the Member.

@param  Request $request Current request object
@return \Illuminate\Http\Response Created MemberTag
Add an MemberTag to the Member .