app/Http/Controllers/EmployeController.php
/**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
Show the form for creating a new resource.
@return \Illuminate\Http\Response
Show the form for creating a new resource . @return \ Illuminate \ Http \ Response
public function create(Request $request,$id='')
    {
        $company=Company::withoutTrashed()->get();
        try{
            if(empty($id)){
                return view('employe.employe_edit',compact('company'));
            }
            $data=Employe::where('status','!=','2')->find($id);
            if(!empty($data)){ 
                return view('employe.employe_edit',compact('data','company'));
            }else{
                $flashArr = array(
                    'msg' => 'Employe details not match'
                );
                $request->session()->flash('err_message',$flashArr);
                return redirect()->route('employe');
            }
        } catch(Exception $e){
            $flashArr = array(
               'msg' => 'Employe creations failed '.$e->getMessage()
            );
            $request->Session()->flash('err_message',$flashArr);
            return redirect()->route('employe');
        }
    }
public function create ( Request $ request , $ id = '' ) { $ company = Company :: withoutTrashed ( ) -> get ( ) ; try { if ( empty ( $ id ) ) { return view ( 'employe.employe_edit' , compact ( 'company' ) ) ; } $ data = Employe :: where ( 'status' , '!=' , '2' ) -> find ( $ id ) ; if ( ! empty ( $ data ) ) { return view ( 'employe.employe_edit' , compact ( 'data' , 'company' ) ) ; } else { $ flashArr = array ( 'msg' => 'Employe details not match' ) ; $ request -> session ( ) -> flash ( 'err_message' , $ flashArr ) ; return redirect ( ) -> route ( 'employe' ) ; } } catch ( Exception $ e ) { $ flashArr = array ( 'msg' => 'Employe creations failed ' . $ e -> getMessage ( ) ) ; $ request -> Session ( ) -> flash ( 'err_message' , $ flashArr ) ; return redirect ( ) -> route ( 'employe' ) ; } }
Show the form for creating a new resource.
Show the form for creating a new resource .