app/Http/Controllers/userLoketController.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->validate($request,[
            'foto'=> 'required|image|mimes:jpeg,png,jpg|max:2048',
            'name'=>'required|string',
            'loket_id'=>'required',
            'email'=>'required|email',
            'password'=>'required|max:100'
        ]);
        $foto = $request->file('foto');
        $namafile = $foto->getClientOriginalName();
        $destinasi = 'public/image/fotoUser';
        $foto->move($destinasi,$namafile);
        $model = new userLoket();
        $model->name = $request->name;
        $model->loket_id = $request->loket_id;
        $model->email = $request->email;
        $model->password = Hash::make($request->password);
        $model->foto = $namafile;
        $model->save();
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'foto' => 'required|image|mimes:jpeg,png,jpg|max:2048' , 'name' => 'required|string' , 'loket_id' => 'required' , 'email' => 'required|email' , 'password' => 'required|max:100' ] ) ; $ foto = $ request -> file ( 'foto' ) ; $ namafile = $ foto -> getClientOriginalName ( ) ; $ destinasi = 'public/image/fotoUser' ; $ foto -> move ( $ destinasi , $ namafile ) ; $ model = new userLoket ( ) ; $ model -> name = $ request -> name ; $ model -> loket_id = $ request -> loket_id ; $ model -> email = $ request -> email ; $ model -> password = Hash :: make ( $ request -> password ) ; $ model -> foto = $ namafile ; $ model -> save ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .