app/Http/Controllers/StepController.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)
    {
        $order = Step::where('program_id', $request->program_id)->count();
        Step::create([
            'step_name'   => $request->step_name,
            'program_id'  => $request->program_id,
            'step_number' => ++$order,
        ]);
        return redirect()->back();
    }
public function store ( Request $ request ) { $ order = Step :: where ( 'program_id' , $ request -> program_id ) -> count ( ) ; Step :: create ( [ 'step_name' => $ request -> step_name , 'program_id' => $ request -> program_id , 'step_number' => ++ $ order , ] ) ; return redirect ( ) -> back ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .