app/Http/Controllers/API/ProgramController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \App\Http\Requests\StoreProgramRequest  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(StoreProgramRequest $request)
    {
        $validated = $request->validate([
            'course_id' =>  'required|numeric',
            'review_type' => 'required',
            'promo' => 'required|max:255',
            'price' => 'required|numeric'
        ]);
        $programs = new Program([
            'course_id' => $request->course_id,
            'review_type' => $request->review_type,
            'promo' => $request->promo,
            'price' => $request->price
        ]);
        $programs->save();
        return response()->json('The Review program successfully added');
    }
public function store ( StoreProgramRequest $ request ) { $ validated = $ request -> validate ( [ 'course_id' => 'required|numeric' , 'review_type' => 'required' , 'promo' => 'required|max:255' , 'price' => 'required|numeric' ] ) ; $ programs = new Program ( [ 'course_id' => $ request -> course_id , 'review_type' => $ request -> review_type , 'promo' => $ request -> promo , 'price' => $ request -> price ] ) ; $ programs -> save ( ) ; return response ( ) -> json ( 'The Review program successfully added' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .