コード例 #1
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $veedor = Veedor::findOrFail($this->route->getParameter('veedores'));
     $parent_rules = parent::rules();
     $my_rules = array('documento' => ['required', 'min:4', 'unique_with:personas,documento,' . $veedor->persona_id . ',id,tipo_doc_id,' . $this->request->get('tipo_doc_id')], 'tipo_doc_id' => ['required', 'numeric', 'unique_with:personas,tipo_doc_id,' . $veedor->persona_id . ',id,documento,' . $this->request->get('documento')]);
     dd($veedor->persona_id);
     $rules = array_merge($parent_rules, $my_rules);
     return $rules;
 }
コード例 #2
0
ファイル: Veedor.php プロジェクト: emitategh/aabcehmt
 /**
  * 
  * @return a list of objects.
  */
 public static function listByFullName($veedor_id = '')
 {
     if ($veedor_id != '') {
         $items = Veedor::where('id', $veedor_id)->get();
     } else {
         $items = Veedor::all();
     }
     $key = 'id';
     $value = 'full_name';
     return Veedor::getListFields($items, $key, $value);
 }
コード例 #3
0
ファイル: Persona.php プロジェクト: emitategh/aabcehmt
 /**
  * 
  * @return integer
  */
 public function esAlgo($es_que = '')
 {
     $persona_id = $this->id;
     switch ($es_que) {
         case 'socio':
             $existe = Socio::where('persona_id', $persona_id)->first();
             break;
         case 'arbitro':
             $existe = Arbitro::where('persona_id', $persona_id)->first();
             break;
         case 'veedor':
             $existe = Veedor::where('persona_id', $persona_id)->first();
             break;
         case 'club':
             $existe = Club::where('persona_id', $persona_id)->first();
             break;
         default:
             $existe = NULL;
             break;
     }
     return $existe;
 }
コード例 #4
0
 /**
  * Necessary show data
  *
  * @param $persona : el objeto persona que se va a mostrar
  * @param $entidad : el objeto entidad que se va a mostrar
  * @param string $entidad_nombre : a que entidad hacemos referencia
  */
 public function showData($persona, $entidad, $entidad_nombre)
 {
     $club = null;
     $plantilla = [];
     $socio = null;
     $trayectoria = [];
     $arbitro = null;
     $veedor = null;
     $active_section = 'info_persona';
     if ($entidad_nombre != 'club') {
         $active_section = 'info_persona';
         if ($entidad_nombre == 'persona') {
             $club = Club::where('persona_id', $persona->id)->first();
         }
         // Si estoy tratando de mostrar los datos del club, no necesito estos datos
         if (is_null($club)) {
             $veedor = $entidad;
             if ($entidad_nombre != 'veedor') {
                 $veedor = Veedor::where('persona_id', $persona->id)->first();
                 if ($veedor) {
                     $active_section = 'info_veedor';
                 }
             }
             $arbitro = $entidad;
             if ($entidad_nombre != 'arbitro') {
                 $arbitro = Arbitro::where('persona_id', $persona->id)->first();
                 if ($arbitro) {
                     $active_section = 'info_arbitro';
                 }
             }
             $socio = $entidad;
             if ($entidad_nombre != 'socio') {
                 $socio = Socio::where('persona_id', $persona->id)->first();
                 if ($socio) {
                     $trayectoria = $socio->trayectoria;
                     $active_section = 'info_socio';
                 }
             }
         } else {
             $active_section = 'info_club';
         }
     } else {
         $club = $entidad;
         $active_section = 'info_club';
     }
     $delegados = [];
     if ($club) {
         $plantilla = $club->plantilla;
         $delegados = $club->delegados;
     }
     $this->webpage['active_section'] = $active_section;
     $this->data = array_merge(['webpage' => $this->webpage, 'persona' => $persona, 'domicilio' => $persona->domicilio, 'telefonos' => $persona->telefonos, 'emails' => $persona->emails, 'web_pages' => $persona->webpages, 'club' => $club, 'plantilla' => $plantilla, 'delegados' => $delegados, 'socio' => $socio, 'trayectoria' => $trayectoria, 'arbitro' => $arbitro, 'veedor' => $veedor], $this->data);
 }
コード例 #5
0
 public function search()
 {
     //DB::enableQueryLog();
     $search_text = Input::get("text");
     $persona = Persona::with(["tipo_documento", "tipo_documento.pais", "domicilio", "domicilio.calle", "domicilio.calle.localidad", "telefonos", "emails", "webpages"])->where("documento", 'LIKE', '%' . $search_text . '%')->first();
     $result = null;
     if ($persona != null) {
         $persona["veedor"] = null;
         $veedor = Veedor::where("persona_id", "=", $persona->id)->first();
         $persona["veedor"] = $veedor;
         $result[] = $persona;
     }
     //dd(DB::getQueryLog());
     return response()->json(['result' => 'Ok', 'response' => $result]);
 }
コード例 #6
0
 public function updateDefinitionVeedor($partido_id, $request)
 {
     $veedor = Veedor::where('id', $request->get('veedor_id'))->first();
     $partido_veedor = PartidoVeedor::firstOrNew(['partido_id' => $partido_id]);
     if ($veedor) {
         $partido_veedor->veedor_id = $veedor->id;
         $partido_veedor->save();
     } else {
         $partido_veedor->forceDelete();
     }
 }