Exemplo n.º 1
0
 public function __construct()
 {
     if (Auth::check()) {
         $this->categories = User::find(Auth::user()->id)->category()->get();
         View::share('categories', $this->categories);
     }
 }
Exemplo n.º 2
0
 public function register(Request $request)
 {
     $rules = array('email_input' => 'required|email', 'pass_input' => 'required', 're_pass_input' => 'required', 'first_name_input' => 'required', 'last_name_input' => 'required', 'phone_input' => 'required');
     $validator = Validator::make($request->all(), $rules);
     if (!$validator->fails()) {
         //cek input form
         $pass = $request->pass_input;
         $re_pass = $request->re_pass_input;
         $permissions = array('user.update' => false);
         $user = array('email' => $request->email_input, 'password' => $pass, 'first_name' => $request->first_name_input, 'last_name' => $request->last_name_input, 'phone' => $request->phone_input, 'status' => '0', 'permissions' => $permissions);
         if ($pass == $re_pass) {
             if (is_null(Sentinel::findByCredentials($user))) {
                 //cek email
                 $register = Sentinel::register($user);
                 $new_member = User::find($register->id);
                 $new_member->phone = $request->phone_input;
                 $new_member->status = '0';
                 $new_member->save();
                 Activation::create($register);
                 $getActive = Activations::where('user_id', $register->id)->first();
                 // get key code from activation table
                 $this->SendConfirmationEmail($request->email_input, $getActive->code, $register->id, $user);
                 // send email, key, id, data($user) to mail
                 return redirect('login_form')->with('success', 'Pendaftaran berhasil kode aktivasi akun telah dikirimkan. Silahkan cek email Anda.');
             } else {
                 return redirect('daftar')->with('error', 'Maaf email Anda sudah terdaftar');
             }
         } else {
             return redirect('daftar')->with('error', 'Password tidak cocok');
         }
     } else {
         return redirect('daftar')->with('error', 'Silahkan isi semua form');
     }
 }
Exemplo n.º 3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CategoryRequest $request)
 {
     try {
         User::find(Auth::user()->id)->category()->create($request->all());
     } catch (Exception $e) {
         echo 'Error Add Category: ' . $e->getMessage();
     }
     return redirect('admin/categories')->with('message', 'Category successfully added!');
 }
Exemplo n.º 4
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     try {
         User::find(Auth::user()->id)->post()->create($request->all());
     } catch (Exception $e) {
         echo 'Error Add Post: ' . $e->getMessage();
     }
     return redirect('admin/posts')->with('message', 'Post successfully added!');
 }
 public function edit($id)
 {
     $result = User::find($id);
     // Sex radio
     if ($result->sex == 'female') {
         $result->status_f = 'checked';
     }
     if ($result->sex == 'male') {
         $result->status_m = 'checked';
     }
     // Interest checkbox
     if (strpos($result, 'Games') !== false) {
         $result->status_g = 'checked';
     }
     if (strpos($result, 'Sport') !== false) {
         $result->status_s = 'checked';
     }
     if (strpos($result, 'Music') !== false) {
         $result->status_mu = 'checked';
     }
     return view('edit-form', compact('result'));
 }
Exemplo n.º 6
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $userInformations = User::find(Auth::user()->id)->get();
     return view('layouts.user.dashboard', ['userInformations']);
 }
Exemplo n.º 7
0
Route::get('/logout', 'Auth\\AuthController@getLogout');
Route::group(['middleware' => ['csrf', 'auth']], function () {
    Route::group(['middleware' => 'role:adminpusat', 'prefix' => 'admin'], function () {
        Route::get('/beranda', 'AdminController@index');
        Route::get('/roles', 'AdminController@roles');
        Route::post('/roles/tambah', 'AdminController@createrole');
        Route::delete('/roles/hapus/{id}', 'AdminController@removerole');
        Route::get('/pengguna/provinsi', 'AdminController@manageadminprovinsi');
        Route::post('/pengguna/provinsi/tambah', 'AdminController@tambahadminprovinsi');
        Route::get('/provinsi/{id}', 'AdminController@provinsi');
    });
    Route::group(['middleware' => 'role:operatorinstansi'], function () {
        Route::get('/beranda', 'OperatorController@index');
        Route::get('/pasien', 'OperatorController@daftarpasien');
        Route::get('/registrasi/pasien', 'OperatorController@registrasipasien');
        Route::post('/registrasi/pasien', 'OperatorController@store');
        Route::get('/pendaftaran/pasien', 'OperatorController@pendaftaran');
        Route::get('/pendaftaran/pasien/{id}', 'OperatorController@caripendaftaran');
        Route::get('/rekam-medis/pasien', 'OperatorController@rekamedis');
        Route::get('/rekam-medis/input-data', 'OperatorController@inputrekamedis');
    });
});
Route::get('cari-kabupaten/{id}', 'AdminController@carikabupaten');
Route::get('cari-kecamatan/{id}', 'AdminController@carikecamatan');
Route::post('oauth/access_token', function () {
    return Response::json(Authorizer::issueAccessToken());
});
Route::get('/profil', ['middleware' => 'oauth', function () {
    $data = User::find(Authorizer::getResourceOwnerId());
    return Response::json(['error' => false, 'data' => $data]);
}]);
Exemplo n.º 8
0
 public static function thisUser()
 {
     $user = \App\Http\Models\User::find(Sentry::getUser()->id);
     return $user;
 }
Exemplo n.º 9
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $user = User::find($id);
     if ($user) {
         $this->withdraw($user);
         return Response::json(['result' => 'OK']);
     }
     return Response::json(['result' => '404']);
 }