app/Http/Controllers/Admin/ApproverController.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);
        $department = new Department();
        $department->department_id = $request->department_id;
        $department->reim_department_id = $request->reim_department_id;
        DB::beginTransaction();
        $department->save();
        $this->saveApprovers($request, $department);
        DB::commit();
        app('Approver')->approverUserToCache();
        $department->load(['approver1', 'approver2', 'approver3']);
        return response($department, 201);
    }
public function store ( Request $ request ) { $ this -> validater ( $ request ) ; $ department = new Department ( ) ; $ department -> department_id = $ request -> department_id ; $ department -> reim_department_id = $ request -> reim_department_id ; DB :: beginTransaction ( ) ; $ department -> save ( ) ; $ this -> saveApprovers ( $ request , $ department ) ; DB :: commit ( ) ; app ( 'Approver' ) -> approverUserToCache ( ) ; $ department -> load ( [ 'approver1' , 'approver2' , 'approver3' ] ) ; return response ( $ department , 201 ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .