app/Http/Controllers/Backsite/DoctorController.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(StoreDoctorRequest $request)
    {
        $data = $request->all();
        $data['fee'] = str_replace(',', '', $data['fee']);
        $data['fee'] = str_replace('IDR ', '', $data['fee']);
        $path = public_path('app/public/assets/file-doctor');
        if(!File::isDirectory($path)){
            $response = Storage::makeDirectory('public/assets/file-doctor');
        }
        if(isset($data['photo'])){
            $data['photo'] = $request->file('photo')->store(
                'assets/file-doctor', 'public'
            );
        }else{
            $data['photo'] = "";
        }
        $doctor = Doctor::create($data);
        alert()->success('Success Message', 'Successfully added new doctor');
        return redirect()->route('backsite.doctor.index');
    }
public function store ( StoreDoctorRequest $ request ) { $ data = $ request -> all ( ) ; $ data [ 'fee' ] = str_replace ( ',' , '' , $ data [ 'fee' ] ) ; $ data [ 'fee' ] = str_replace ( 'IDR ' , '' , $ data [ 'fee' ] ) ; $ path = public_path ( 'app/public/assets/file-doctor' ) ; if ( ! File :: isDirectory ( $ path ) ) { $ response = Storage :: makeDirectory ( 'public/assets/file-doctor' ) ; } if ( isset ( $ data [ 'photo' ] ) ) { $ data [ 'photo' ] = $ request -> file ( 'photo' ) -> store ( 'assets/file-doctor' , 'public' ) ; } else { $ data [ 'photo' ] = " " ; } $ doctor = Doctor :: create ( $ data ) ; alert ( ) -> success ( 'Success Message' , 'Successfully added new doctor' ) ; return redirect ( ) -> route ( 'backsite.doctor.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// get all request from frontsite // re format before push to table // upload process here // change file locations // store to database