app/Http/Controllers/UserController.php
/**
     * Register new user
     *
     * @param $request Request
     */
Register new user
@param $request Request
Register new user @param $request Request
public function register(Request $request)
    {
        $hasher = app()->make('hash');
        $email = $request->input('email');
        $password = $hasher->make($request->input('password'));
        $nama = $request->input('nama');
        $nik = $request->input('nik');
        $no_telp = $request->input('no_telp');
        $jenis_kelamin = $request->input('jenis_kelamin');
        $alamat = $request->input('alamat');
        $foto = $request->input('foto');
        $level = 'user';
        $register = User::create([
            'email'=> $email,
            'password'=> $password,
            'nama'=> $nama,
            'nik'=> $nik,
            'no_telp'=> $no_telp,
            'jenis_kelamin'=> $jenis_kelamin,
            'alamat'=> $alamat,
            'foto'=> $foto,
            'level'=> $level,
        ]);
        if ($register) {
            $res['success'] = true;
            $res['message'] = 'Tambah user sukses!';
            return response($res);
        }else{
            $res['success'] = false;
            $res['message'] = 'Tambah user gagal!';
            return response($res);
        }
    }
public function register ( Request $ request ) { $ hasher = app ( ) -> make ( 'hash' ) ; $ email = $ request -> input ( 'email' ) ; $ password = $ hasher -> make ( $ request -> input ( 'password' ) ) ; $ nama = $ request -> input ( 'nama' ) ; $ nik = $ request -> input ( 'nik' ) ; $ no_telp = $ request -> input ( 'no_telp' ) ; $ jenis_kelamin = $ request -> input ( 'jenis_kelamin' ) ; $ alamat = $ request -> input ( 'alamat' ) ; $ foto = $ request -> input ( 'foto' ) ; $ level = 'user' ; $ register = User :: create ( [ 'email' => $ email , 'password' => $ password , 'nama' => $ nama , 'nik' => $ nik , 'no_telp' => $ no_telp , 'jenis_kelamin' => $ jenis_kelamin , 'alamat' => $ alamat , 'foto' => $ foto , 'level' => $ level , ] ) ; if ( $ register ) { $ res [ 'success' ] = true ; $ res [ 'message' ] = 'Tambah user sukses!' ; return response ( $ res ) ; } else { $ res [ 'success' ] = false ; $ res [ 'message' ] = 'Tambah user gagal!' ; return response ( $ res ) ; } }
Register new user
 @param $request Request
Register new user @param $request Request