public function store(Request $request)
    {
        $rules = [
            "content" => "required|max:1024",
        ];
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate($this->addPolymorphicRules($rules, 'noteable', $request->noteableType));
        $note = new Note();
        $note->content = $request->get("content");
        $note->noteable_id = $request->get("noteableId");
        $note->noteable_type = $request->get("noteableType");
        $this->authorize('manage', $note);
        $note->save();
        return fractal($note, new NoteTransformer())
            ->withResourceName('note')
            ->respond();
    }
public function store(Request $request)
    {
        $rules = [
            "content" => "required|max:1024",
        ];
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate($this->addPolymorphicRules($rules, 'noteable', $request->noteableType));
        $note = new Note();
        $note->content = $request->get("content");
        $note->noteable_id = $request->get("noteableId");
        $note->noteable_type = $request->get("noteableType");
        $this->authorize('manage', $note);
        $note->save();
        return fractal($note, new NoteTransformer())
            ->withResourceName('note')
            ->respond();
    }
public function store ( Request $ request ) { $ rules = [ "content" => "required|max:1024" , ] ; /** @noinspection PhpUndefinedMethodInspection */ $ request -> validate ( $ this -> addPolymorphicRules ( $ rules , 'noteable' , $ request -> noteableType ) ) ; $ note = new Note ( ) ; $ note -> content = $ request -> get ( "content" ) ; $ note -> noteable_id = $ request -> get ( "noteableId" ) ; $ note -> noteable_type = $ request -> get ( "noteableType" ) ; $ this -> authorize ( 'manage' , $ note ) ; $ note -> save ( ) ; return fractal ( $ note , new NoteTransformer ( ) ) -> withResourceName ( 'note' ) -> respond ( ) ; }
Store a new Note
@param  \Illuminate\Http\Request $request current Request object
@return \Illuminate\Http\Response JSON object of created Note
Store a new Note