app/Http/Controllers/PostController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $post = \App\Post::create($request->all());
        $pencipta = new Pencipta;
        $pencipta->nama_pencipta = $request->input('nama_pencipta');
        $post->pencipta()->save($pencipta);
        $post->tag()->attach($request->input('tag_post'));
        return redirect('/post');
    }
public function store ( Request $ request ) { $ post = \ App \ Post :: create ( $ request -> all ( ) ) ; $ pencipta = new Pencipta ; $ pencipta -> nama_pencipta = $ request -> input ( 'nama_pencipta' ) ; $ post -> pencipta ( ) -> save ( $ pencipta ) ; $ post -> tag ( ) -> attach ( $ request -> input ( 'tag_post' ) ) ; return redirect ( '/post' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .