app/Http/Controllers/Admin/FundingBrandController.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->validater($request);
        $reimDepartment = new ReimDepartment();
        $reimDepartment->name = $request->name;
        $reimDepartment->manager_sn = $request->manager_sn;
        $reimDepartment->manager_name = $request->manager_name;
        $reimDepartment->cashier_sn = $request->cashier_sn;
        $reimDepartment->cashier_name = $request->cashier_name;
        DB::beginTransaction();
        $reimDepartment->save();
        $reimDepartment->auditor()->createMany($request->auditor);
        DB::commit();
        $reimDepartment->load('auditor');
        return response($reimDepartment, 201);
    }
public function store ( Request $ request ) { $ this -> validater ( $ request ) ; $ reimDepartment = new ReimDepartment ( ) ; $ reimDepartment -> name = $ request -> name ; $ reimDepartment -> manager_sn = $ request -> manager_sn ; $ reimDepartment -> manager_name = $ request -> manager_name ; $ reimDepartment -> cashier_sn = $ request -> cashier_sn ; $ reimDepartment -> cashier_name = $ request -> cashier_name ; DB :: beginTransaction ( ) ; $ reimDepartment -> save ( ) ; $ reimDepartment -> auditor ( ) -> createMany ( $ request -> auditor ) ; DB :: commit ( ) ; $ reimDepartment -> load ( 'auditor' ) ; return response ( $ reimDepartment , 201 ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .