app/Http/Controllers/Api/CategoryController.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)
    {
        $this->validate($request, [
            'name' => 'required',
        ]);
        $category = Category::create($request->all());
        return $this->formatJsonOutput($category);
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required' , ] ) ; $ category = Category :: create ( $ request -> all ( ) ) ; return $ this -> formatJsonOutput ( $ category ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .