/**
  * Store a newly created resource in storage.
  *
  * @param CreatePersonRequest $request
  * @return Response
  */
 public function postStorepeople(CreatePersonRequest $request)
 {
     $people = new People();
     $people->document = $request->get('document');
     $people->names = $request->get('names');
     $people->surnames = $request->get('surnames');
     $people->date_of_birth = $request->get('date_of_birth');
     $people->landline = $request->get('landline');
     $people->address = $request->get('address');
     $people->date_of_admission = $request->get('date_of_admission');
     $people->cellular = $request->get('cellular');
     $upload_dir = \Storage::disk('photos');
     $img = $request->get('photo');
     $img = str_replace('data:image/png;base64,', '', $img);
     $data = base64_decode($img);
     $name = date('YmdHis') . '.png';
     $upload_dir->put($name, $data);
     $people->photo = $name;
     $people->save();
     $email = $request->get('email');
     $password = $request->get('password');
     $user = new User(['email' => $email, 'password' => $password]);
     $people->user()->save($user);
     Session::flash('message', 'Usuario registro correctamente en el sistema.');
     return redirect('auth/login');
 }
Ejemplo n.º 2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function createpeople()
 {
     $people = new People();
     $people->name = Input::get('name');
     $people->title = Input::get('title');
     $people->department = Input::get('department');
     $people->phone = Input::get('phone');
     $people->email = Input::get('email');
     $people->remark = Input::get('remark');
     $people->save();
     return 'success';
 }
Ejemplo n.º 3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //$peoples  = People::all();
     $companys = array('asiaa', 'cfa', 'unam', 'ntu');
     $asiaa = People::company('Asiaa')->get();
     $unam = People::company('UNAM')->get();
     $cfa = People::company('CfA')->get();
     $cfa = People::company('NTU')->get();
     //var_dump($asiaa);
     return view('frontend.about')->with('companys', compact('asiaa', 'unam', 'cfa', 'ntu'));
     //
 }
Ejemplo n.º 4
0
 public function edit($entity)
 {
     parent::edit($entity);
     $this->edit = \DataEdit::source(new \App\Movement());
     $this->edit->label('Movimeiento');
     $this->edit->add('fecha', 'Fecha', 'date')->rule('required')->format('d/m/Y', 'es');
     $this->edit->add('tipo', 'Tipo', 'radiogroup')->rule('required')->option('ingreso', 'Ingreso')->option('egreso', 'Egreso')->insertValue('egreso');
     $this->edit->add('category_id', 'Categoría', 'select')->rule('required')->options(\App\Category::lists('nombre', 'id')->all());
     $this->edit->add('person_id', 'Persona', 'select')->rule('required')->options(\App\People::lists('nombre', 'id')->all());
     $this->edit->add('group_id', 'Grupo', 'select')->rule('required')->options(\App\Group::lists('nombre', 'id')->all());
     $this->edit->add('monto', 'Monto ($)', 'text')->rule('required');
     $this->edit->add('comprobante', 'Comprobante', 'file')->move('media/comprobantes/');
     $this->edit->add('notas', 'Notas', 'textarea')->rule('required');
     return $this->returnEditView();
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     // People route-model binding
     $router->bind('peoples', function ($id) {
         return \App\People::findOrFail($id);
     });
     // Project route-model binding
     $router->bind('projects', function ($id) {
         return \App\Project::findOrFail($id);
     });
     // Publication route-model binding
     $router->bind('publications', function ($id) {
         return \App\Publication::findOrFail($id);
     });
     // Email route-model binding
     $router->bind('emails', function ($id) {
         return \App\Email::findOrFail($id);
     });
 }
Ejemplo n.º 6
0
 public function cargaGasto(Request $request)
 {
     debug($request->session()->get('user'));
     if (!$request->session()->get('user')) {
         return redirect('/auth/google');
     }
     $form = \DataEdit::source(new Movement());
     $form->add('fecha', 'Fecha', 'date')->rule('required')->format('d/m/Y', 'es');
     $form->add('tipo', 'Tipo', 'radiogroup')->rule('required')->option('ingreso', 'Ingreso')->option('egreso', 'Egreso')->insertValue('egreso');
     $form->add('category_id', 'Categoría', 'select')->rule('required')->options(\App\Category::lists('nombre', 'id')->all());
     $form->add('person_id', 'Persona', 'select')->rule('required')->options(\App\People::lists('nombre', 'id')->all());
     $form->add('group_id', 'Grupo', 'select')->rule('required')->options(\App\Group::lists('nombre', 'id')->all());
     $form->add('monto', 'Monto ($)', 'text')->rule('required');
     $form->add('comprobante', 'Comprobante', 'file')->move('media/comprobantes/');
     $form->add('notas', 'Notas', 'textarea')->rule('required');
     $form->saved(function () use($form) {
         $form->message("Gasto guardado");
         $form->link("/cargar", "Ingresar otro");
     });
     return $form->view('gasto', compact('form'))->with('tab', 'gastos');
 }
 /**
  * Delete an existing people from storage.
  *
  * @param People $people
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  * @throws \Exception
  */
 public function managePeopleDestroy(People $people)
 {
     $people->delete();
     return redirect('admin/peoples');
 }
Ejemplo n.º 8
0
 /**
  * Get the list of current students.
  *
  * @return mixed
  */
 public static function getPeopleType($type)
 {
     return People::where('type', '=', $type)->get();
 }
Ejemplo n.º 9
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $people = \App\People::orderBy('id', 'desc')->get()->all();
     return view('index', ['people' => $people]);
 }
Ejemplo n.º 10
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $people = People::all();
     $cpu = asset::whereRaw('status = "idle" and type = "cpu"')->get();
     $memory = asset::whereRaw('status="idle" and type="memory"')->get();
     $mainboard = asset::whereRaw('status="idle" and type="mainboard"')->get();
     $harddisk = asset::whereRaw('status="idle" and type="harddisk"')->get();
     $device = devices::find($id);
     $owner = $device->belongsTopeople;
     $device['owner'] = $owner;
     $asset = array();
     $asset['cpu'] = asset::whereRaw('type="cpu" and device_id=' . $id . ' and status="using"')->get();
     $asset['memory'] = asset::whereRaw('type="memory" and device_id=' . $id . ' and status="using"')->get();
     $asset['harddisk'] = asset::whereRaw('type="harddisk" and device_id=' . $id . ' and status="using"')->get();
     $asset['mainboard'] = asset::whereRaw('type="mainboard" and device_id=' . $id . ' and status="using"')->get();
     return view('hardware.editdevice')->withDevices($device)->withPeople($people)->withCpu($cpu)->withMemory($memory)->withMainboard($mainboard)->withHarddisk($harddisk)->withAsset($asset);
 }
Ejemplo n.º 11
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     return (string) \App\People::find($id)->delete();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     People::destroy($id);
     return redirect('person');
 }
 public function viewPeople()
 {
     $sum_cost = $this->getTotalCost();
     $total_members = $this->getTotalMember();
     $people = People::get()->toArray();
     return view('people', compact('people'))->with('sum_cost', $sum_cost)->with('total_members', $total_members);
 }
 /**
  * @param AddRoleRequest $request
  * @return \Illuminate\View\View
  */
 public function postAddroleindex(AddRoleRequest $request)
 {
     $branch = Branch::findOrFail($request->get('branch_id'));
     $people = People::where('document', $request->get('document'))->get();
     if (!$branch->worker->isEmpty()) {
         $worker = $branch->worker;
         $int = 0;
         foreach ($worker as $w) {
             if ($w->people_id == $people[0]->id) {
                 $int++;
             }
         }
         if ($int != 0) {
             flash()->overlay('No se pudo realizar la operación debido a que ya está registrada la persona ' . $people[0]->names . ' como empleado de esta sucursal.', 'Notificación de errores');
             $people = People::all();
             return redirect(url('/admin/role'));
         } else {
             $branch->worker()->save(new Worker(['people_id' => $people[0]->id]));
             $user = $people[0]->user;
             $user->roles()->sync($request->get('role_ids'));
             flash()->success('Se realizó la asignación de roles con éxito.');
             return redirect(url('/admin/role'));
         }
     } else {
         $branch->worker()->save(new Worker(['people_id' => $people[0]->id]));
         $user = $people[0]->user;
         $user->roles()->sync($request->get('role_ids'));
         flash()->success('Se realizó la asignación de roles con éxito.');
         return redirect(url('/admin/role'));
     }
 }
Ejemplo n.º 15
0
 /**  
  * Delete a given person
  *
  * @return Response
  */
 public function destroy($id)
 {
     $people = People::findOrFail($id);
     $people->delete();
     $message = trans('people.delete_success_message');
     return redirect('people')->with('OK', $message . ' : ' . $people->name . ' ' . $people->last_name);
 }