app/Http/Controllers/PostController.php
/**
     * Update the specified resource in storage.
     *
     * @param \Illuminate\Http\Request $request
     * @param \App\Post $post
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
        $post_data = Post::findOrFail($id);
        if ($post_data->status == 1) {
            $post_data->update(['status' => 0]);
        } else {
            $post_data->update(['status' => 1]);
        }
        Toastr::success('Post published', 'Success', ["positionClass" => "toast-bottom-right"]);
        return back();
    }
public function update ( Request $ request , $ id ) { $ post_data = Post :: findOrFail ( $ id ) ; if ( $ post_data -> status == 1 ) { $ post_data -> update ( [ 'status' => 0 ] ) ; } else { $ post_data -> update ( [ 'status' => 1 ] ) ; } Toastr :: success ( 'Post published' , 'Success' , [ " positionClass " => " toast-bottom-right " ] ) ; return back ( ) ; }
Update the specified resource in storage.
Update the specified resource in storage .