示例#1
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $user = data_akses_gudang::firstOrCreate(['id_user' => $this->req['user']]);
     $user->tipe = $this->req['tipe'];
     $user->save();
     $u = User::find($this->req['user']);
     $tipe = $this->req['tipe'] == 1 ? 'Obat' : 'Barang';
     \Loguser::create('Memberikan Akses Gudang ' . $tipe . ' kepada ' . $u->name);
     return $user;
 }
示例#2
0
 public function statusGudang()
 {
     $user = \Auth::user();
     if ($user->permission < 3) {
         $gudang = data_akses_gudang::whereId_user($user->id_user);
         if ($gudang->count() > 0) {
             $res = $gudang->first();
             return $res->tipe;
             /* Gudang atau Obat */
         } else {
             return 0;
         }
     } else {
         return 3;
     }
 }
    public function getGetusergudang(Request $req)
    {
        if ($req->ajax()) {
            $res = [];
            $out = '';
            $users = data_akses_gudang::show($req->all())->paginate($req->limit);
            $no = $users->currentPage() == 1 ? 1 : $users->perPage() * $users->currentPage() - $users->perPage() + 1;
            if ($users->total() > 0) {
                foreach ($users as $user) {
                    $tipe1 = $user->tipe == 1 ? 'checked="checked"' : '';
                    $tipe2 = $user->tipe == 2 ? 'checked="checked"' : '';
                    $out .= '
					<tr class="user-' . $user->id_akses_gudang . '">
						<td>' . $no . '</td>
						<td>
							' . $user->name . '
							<div class="link">
								<small>[
									<a href="javascript:;" onclick="del(' . $user->id_akses_gudang . ');" class="text-danger">Hapus</a>
								]</small>
							</div>
						</td>
						<td>
							<label for="obat' . $user->id_akses_gudang . '">
								<input type="radio" value="1" name="tipe' . $user->id_akses_gudang . '" onclick="edit(1, ' . $user->id_akses_gudang . ');" id="obat' . $user->id_akses_gudang . '" ' . $tipe1 . '> 
								<small>Obat</small>
							</label>
							
							<label for="barang' . $user->id_akses_gudang . '">
								<input type="radio" value="2" name="tipe' . $user->id_akses_gudang . '" onclick="edit(2, ' . $user->id_akses_gudang . ');" id="barang' . $user->id_akses_gudang . '" ' . $tipe2 . '>
								<small>barang</small>
							</label>
						</td>
						<td>
							' . \Format::indoDate($user->created_at) . '
							<div><small class="text-muted">' . \Format::hari($user->created_at) . ', ' . \Format::jam($user->created_at) . '</small></div>
						</td>
					</tr>
				';
                    $no++;
                }
            } else {
                $out = '
					<tr>
						<td colspan="4">Tidak ditemukan</td>
					</tr>';
            }
            $res['pagin'] = $users->render();
            $res['content'] = $out;
            return json_encode($res);
        }
    }