/** * Show the form for creating a new resource. * * @return Response */ public function create() { if (Sentinel::hasAccess('depositos.view')) { $deposito = new Deposito(); return view('contabilidad::Deposits.index', compact('deposito')); } else { alert()->error('No tiene permisos para acceder a esta area.', 'Oops!')->persistent('Cerrar'); return back(); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // if (Sentinel::hasAccess('test.create')) { $test = Test::find($id); return view('PackageTest::test.create', compact('test')); } else { // Execute this code if the permission check failed return back()->withErrors('No tiene permisos para acceder a esta area.'); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // if (Sentinel::hasAccess(['role.update'])) { // Execute this code if the user has permission $roles = Sentinel::findRoleById($id); return view('roles.create', compact('roles')); } else { // Execute this code if the permission check failed return back()->withErrors('No tiene permisos para acceder a esta area.'); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { if (Sentinel::hasAccess(['role.permissions'])) { // Execute this code if the user has permission //find role by id $roles = Sentinel::findRoleById($id); // find all package with his permissions $permissions = Module::with('permissions')->get(); return view('permissions::create', compact('permissions', 'roles')); } else { alert()->error('No tiene permisos para acceder a esta area.', 'Oops!')->persistent('Cerrar'); return back(); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { if (Sentinel::hasAccess(['role.permissions'])) { // Execute this code if the user has permission //find role by id $roles = Sentinel::findRoleById($id); // find all package with his permissions $permissions = Module::with('permissions')->get(); return view('permissions.create', compact('permissions', 'roles')); } else { // Execute this code if the permission check failed return back()->withErrors('No tiene permisos para acceder a esta area.'); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (Sentinel::check()) { if (Sentinel::hasAccess('cuentas.view')) { $cuentas = Cuentas::all(); $cuentas->load('bancom'); return view('contabilidad::Cuentas.index', compact('cuentas')); } alert()->error('No tiene permisos para acceder a esta area.', 'Oops!')->persistent('Cerrar'); return back(); } else { return redirect('login'); } }
public function index() { if (Sentinel::check()) { if (Sentinel::hasAccess('cancelaciones.view')) { $plazas = Place::plazasArray($this->user_auth->id); return view('contabilidad::Cancel.index', compact("plazas")); } else { alert()->error('No tiene permisos para acceder a esta area.', 'Oops!')->persistent('Cerrar'); return back(); } } else { return redirect('login'); } }
public function index() { if (Sentinel::check()) { if (Sentinel::hasAccess('polizas.view')) { $fechaAyer = Carbon::now()->subDay()->format('Y/m/d'); $plazas = Place::plazasArray($this->user_auth->id); return view('contabilidad::Policies.form', compact('plazas', 'fechaAyer')); } else { alert()->error('No tiene permisos para acceder a esta area.', 'Oops!')->persistent('Cerrar'); return back(); } } else { return redirect('login'); } }
public function index() { if (Sentinel::check()) { if (Sentinel::hasAccess('antiguedad.view')) { $fechaActual = Carbon::now()->format('Y/m/d'); $payment_methods = PaymentMethod::all(); $plazas = Place::plazasArray($this->user_auth->id); return view('contabilidad::OldBalance.form', compact("payment_methods", "plazas", "fechaActual")); } else { alert()->error('No tiene permisos para acceder a esta area.', 'Oops!')->persistent('Cerrar'); return back(); } } else { return redirect('login'); } }
public function index() { if (Sentinel::check()) { if (Sentinel::hasAccess('pendientes.view')) { $usuario = User::find($this->user_auth->id); $oficinas = array(); foreach ($usuario->plazas as $plazas) { array_push($oficinas, $plazas->Oficina); } DB::enableQueryLog(); $ventasPendientes = Sales::select('*', DB::raw('SUM(ammount) as ammount, SUM(ammount_applied) as ammount_applied '))->whereRaw('credit_debit = ? ', ['credit'])->groupBy('reference')->get(); return view('contabilidad::Earrings.index', compact("ventasPendientes")); } else { alert()->error('No tiene permisos para acceder a esta area.', 'Oops!')->persistent('Cerrar'); return back(); } } else { return redirect('login'); } }
public function index() { if (Sentinel::check()) { if (Sentinel::hasAccess('ventas.view')) { $usuario = User::find($this->user_auth->id); $oficinas = array(); foreach ($usuario->plazas as $plazas) { array_push($oficinas, $plazas->Oficina); } $salesLogs = SalesLog::whereIn('op_location', $oficinas)->orWhere(function ($query) use($oficinas) { $query->whereIn('cl_location', $oficinas); })->get(); return view('contabilidad::Sales.index', compact('salesLogs')); } else { alert()->error('No tiene permisos para acceder a esta area.', 'Oops!')->persistent('Cerrar'); return back(); } } else { return redirect('login'); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // if (Sentinel::hasAccess('task.update')) { $task = Task::find($id); $users = User::select(DB::raw("CONCAT(first_name ,' ', last_name) AS full_name, id"))->get(); $roles = Role::all(); $task['date'] = str_replace('-', '/', $task->start_time) . " - " . str_replace('-', '/', $task->expire_time); return view('notifications.tasks.update', compact('task', 'users', 'roles')); } else { return back()->withErrors(['NoAccess' => 'No tiene permisos para acceder a esta area.']); } }
/** * @param $id */ public function destroy($id) { if (Sentinel::hasAccess('user.delete')) { if ($user = Sentinel::findById($id)) { $image_old = $user->image; $user->delete(); if (strcmp($image_old, 'avatar-larus.jpeg') != 0) { $filename = public_path() . '/img/users/' . $image_old; if (\File::exists($filename)) { \File::delete($filename); } } } } else { return response()->json(['error' => 'No tiene permisos para acceder a esta area.'], 401); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // if (Sentinel::hasAccess('user.update')) { // Execute this code if the user has permission $users = Sentinel::findById($id); $rolUser = $users->roles()->get(); $roles = Role::all()->lists('name', 'slug'); return view('users.edit', compact('users', 'roles', 'rolUser')); } else { return back()->withErrors('You are not permitted to access this area.'); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // if (Sentinel::hasAccess('notification.update')) { $notification = Notification::find($id); $users = User::select(DB::raw("CONCAT(first_name ,' ', last_name) AS full_name, id"))->get(); $roles = Role::all(); return view('notifications.notifications.update', compact('notification', 'users', 'roles')); } else { return back()->withErrors(['NoAccess' => 'No tiene permisos para acceder a esta area.']); } }
public function destroy($id) { if (Sentinel::hasAccess('task.delete')) { $this->model->destroy($id); } else { return response()->json(['error' => 'No tiene permisos para acceder a esta area.'], 401); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if (Sentinel::hasAccess('role.delete')) { $affectedRows = DB::table('role_users')->where('role_id', '=', $id)->get(); if (empty($affectedRows)) { if ($role = Sentinel::findRoleById($id)) { $role->delete(); } return \Redirect::to('roles')->withErrors('No se pudo eliminar el rol.'); } } else { return response()->json(['error' => 'No tiene permisos para acceder a esta area.'], 401); } }
public function registerMenu() { if (!Sentinel::check()) { return redirect('login'); } $menu = Menu::instance('sidebar-menu'); if (Sentinel::hasAccess('ventas.view') || Sentinel::hasAccess('pendientes.view') || Sentinel::hasAccess('depositos.view') || Sentinel::hasAccess('cancelaciones.view') || Sentinel::hasAccess('polizas.view') || Sentinel::hasAccess('antiguedad.view') || Sentinel::hasAccess('auxmovimientos.view') || Sentinel::hasAccess('estadocuenta.view') || Sentinel::hasAccess('cuentas.view')) { $menu->dropdown('Contabilidad', function ($sub) { if (Sentinel::hasAccess('ventas.view')) { $sub->route('contabilidad.ventas.index', 'Ventas', [], 1, ['icon' => 'fa fa-circle-o']); } if (Sentinel::hasAccess('pendientes.view')) { $sub->route('contabilidad.pendientes.index', 'Pendientes', [], 1, ['icon' => 'fa fa-circle-o']); } if (Sentinel::hasAccess('depositos.view')) { $sub->route('contabilidad.depositos.index', 'Depósitos', [], 1, ['icon' => 'fa fa-circle-o']); } if (Sentinel::hasAccess('cancelaciones.view')) { $sub->route('contabilidad.cancelaciones.index', 'Cancelaciones', [], 1, ['icon' => 'fa fa-circle-o']); } if (Sentinel::hasAccess('polizas.view')) { $sub->route('contabilidad.polizas.index', 'Pólizas', [], 1, ['icon' => 'fa fa-circle-o']); } if (Sentinel::hasAccess('cuentas.view')) { $sub->route('contabilidad.cuentas.index', 'Cuentas', [], 1, ['icon' => 'fa fa-circle-o']); } if (Sentinel::hasAccess('antiguedad.view') || Sentinel::hasAccess('auxmovimientos.view')) { $sub->dropdown('Reportes', 2, function ($sub2) { if (Sentinel::hasAccess('antiguedad.view')) { $sub2->route('contabilidad.antiguedad.index', 'Antigüedad de saldos', [], 1, ['icon' => 'fa fa-circle-o']); } if (Sentinel::hasAccess('auxmovimientos.view')) { $sub2->route('contabilidad.antiguedad.index', 'Auxiliar de movimientos', [], 1, ['icon' => 'fa fa-circle-o']); } }, ['icon' => 'fa fa-bar-chart']); } if (Sentinel::hasAccess('estadocuenta.view')) { $sub->dropdown('Importar', 2, function ($sub2) { $sub2->route('contabilidad.antiguedad.index', 'Estado de cuenta', [], 1, ['icon' => 'fa fa-circle-o']); }, ['icon' => 'fa fa-cloud-upload']); } }, 2, ['icon' => 'fa fa-balance-scale']); } }