示例#1
0
 public static function AplicativoFaltantedelTicket($idPersona)
 {
     $resultado = \DB::table('aplicativo')->select(['aplicativo.id', 'aplicativo.nombre_aplicativo'])->whereNotIn('aplicativo.id', function ($query) use($idPersona) {
         $query->select(['aplicativo_ticket_persona.aplicativo_id'])->from('persona_tickets')->where('persona_tickets.persona_id', $idPersona)->join('aplicativo_ticket_persona', 'persona_tickets.id', '=', 'aplicativo_ticket_persona.ticket_persona_id')->get();
     })->get();
     return $resultado;
 }
示例#2
0
 public static function buscarAplicativoRelacionados2($idTicket_persona)
 {
     $result = \DB::table('aplicativo_ticket_persona')->select(['aplicativo.nombre_aplicativo', 'aplicativo.id', 'aplicativo_ticket_persona.created_at', 'aplicativo_ticket_persona.usucrea'])->whereIn('aplicativo_ticket_persona.ticket_persona_id', function ($query) use($idTicket_persona) {
         $query->select(['persona_tickets.id'])->from('persona_tickets')->where('persona_tickets.id', $idTicket_persona)->get();
     })->join('aplicativo', 'aplicativo_ticket_persona.aplicativo_id', '=', 'aplicativo.id')->get();
     return $result;
 }
示例#3
0
 public static function notify($idArr = array(), $body, $type, $to_all = 0, $is_system = 0)
 {
     $currentId = auth()->id();
     if (!$currentId) {
         return;
     }
     $data = $notifiedUidArr = [];
     $now = \Carbon\Carbon::now();
     if ($to_all) {
         $data = ['user_id' => 0, 'body' => $body, 'type' => $type, 'to_all' => $to_all, 'is_system' => $is_system, 'created_at' => $now, 'updated_at' => $now];
     } elseif (!empty($idArr)) {
         $idArr = array_unique($idArr);
         foreach ($idArr as $id) {
             if ($id == $currentId) {
                 return;
             }
             $data[] = ['user_id' => $id, 'body' => $body, 'type' => $type, 'to_all' => $to_all, 'is_system' => $is_system, 'created_at' => $now, 'updated_at' => $now];
             $notifiedUidArr[] = $id;
         }
     }
     if (!empty($data)) {
         Notify::insert($data);
         if ($to_all) {
             \DB::table('users')->increment('notice_count');
         } elseif ($notifiedUidArr) {
             User::whereIn('id', $notifiedUidArr)->increment('notice_count');
         }
     }
 }
示例#4
0
 /**
  * [getMatches description]
  * @param  [type] $tournament_id [description]
  * @param  [type] $player_id     [description]
  * @return [type]                [description]
  */
 public function getMatches($tournament_id, $player_id)
 {
     $m = \DB::table('matches')->join('tournaments', 'tournaments.tournament_id', '=', 'matches.tournament_id')->join('players as winner', 'winner.player_id', '=', 'matches.player1_id')->join('players as loser', 'loser.player_id', '=', 'matches.player2_id')->where('matches.tournament_id', '=', $tournament_id)->where(function ($q) use($player_id) {
         $q->where('player1_id', '=', $player_id)->orWhere('player2_id', '=', $player_id);
     })->orderBy('match_division')->orderBy('round')->select('*', 'winner.first_name as winner_first_name', 'winner.last_name as winner_last_name', 'loser.first_name as loser_first_name', 'loser.last_name as loser_last_name', 'loser.player_id as loser_id', 'tournaments.name as tournament')->distinct()->get();
     return $m;
 }
示例#5
0
 public function closest($lat, $lng, $max_distance = 25, $max_locations = 10, $units = 'miles', $fields = false)
 {
     /*
      *  Allow for changing of units of measurement
      */
     switch ($units) {
         case 'miles':
             //radius of the great circle in miles
             $gr_circle_radius = 3959;
             break;
         case 'kilometers':
             //radius of the great circle in kilometers
             $gr_circle_radius = 6371;
             break;
     }
     /*
      *  Support the selection of certain fields
      */
     if (!$fields) {
         $fields = array('*');
     }
     /*
      *  Generate the select field for disctance
      */
     $disctance_select = sprintf("( %d * acos( cos( radians(%s) ) " . " * cos( radians( lat ) ) " . " * cos( radians( lng ) - radians(%s) ) " . " + sin( radians(%s) ) * sin( radians( lat ) ) " . ") " . ") " . "AS distance", $gr_circle_radius, $lat, $lng, $lat);
     return DB::table($table)->having('distance', '<', $max_distance)->take($max_locations)->order_by('distance', 'ASC')->get(array($fields, $disctance_select));
 }
 public static function cuentasAplicativosExportar($ticket_id)
 {
     $resultado = \DB::table('cuenta')->select(['cuenta.id', 'cuenta.cuenta_usu', 'ticket.nroticket', 'aplicativo.nombre_aplicativo', 'cuenta.created_at', 'cuenta.clave'])->whereIn('cuenta.aplicativo_ticket_id', function ($query) use($ticket_id) {
         $query->select(['aplicativo_tickets.id'])->from('ticket')->where('ticket.id', $ticket_id)->join('aplicativo_tickets', 'ticket.id', '=', 'aplicativo_tickets.ticket_id')->join('aplicativo', 'aplicativo_tickets.aplicativo_id', '=', 'aplicativo.id')->get();
     })->join('aplicativo_tickets', 'cuenta.aplicativo_ticket_id', '=', 'aplicativo_tickets.id')->join('aplicativo', 'aplicativo_tickets.aplicativo_id', '=', 'aplicativo.id')->join('ticket', 'aplicativo_tickets.ticket_id', '=', 'ticket.id')->get();
     return $resultado;
 }
示例#7
0
 public static function AplicativoAreaFaltante($idarea)
 {
     $resultado = \DB::table('aplicativo')->select(['aplicativo.id', 'aplicativo.nombre_aplicativo'])->whereNotIn('aplicativo.id', function ($query) use($idarea) {
         $query->select(['aplicativo_area.aplicativo_id'])->from('aplicativo_area')->where('area.id', $idarea)->join('area', 'aplicativo_area.area_id', '=', 'area.id')->get();
     })->get();
     return $resultado;
 }
示例#8
0
 public function select()
 {
     $user = DB::table('login')->where('name', 'crdf')->first();
     var_dump($user);
     die;
     return $user->name;
 }
示例#9
0
 public function user()
 {
     //return $this->hasManyThrough('App\User','App\AccountLink',
     //	                          'user_id', 'id', 'app_user_id');
     $user = \DB::table('users')->join('account_links', 'users.id', '=', 'account_links.user_id')->where('account_links.app_user_id', '=', $this->id)->first();
     return $user;
 }
示例#10
0
文件: Tablero.php 项目: klas120/cmi
 public static function callStatesIndicator($ind)
 {
     //$p = \DB::statement('call PKG_CMI_INDICATOR_STATES.PROC_MAKE_FEED(?,?,?)',[$stateid, $val, $user]);
     //$p = \DB::exec('pkg_cmi_indicator_states.func_get_valid_fees(?, ?, ?)',[$ind, $per, $user]);
     //$p= \DB::table('select * from CMI_INDICATOR_STATE t where t.indicatorid = '.$ind.';');
     $datasStates = \DB::table('CMI_INDICATOR_STATE')->select('*')->where('indicatorid', '=', $ind)->get();
     return $datasStates;
 }
示例#11
0
 function getName()
 {
     DB::table('users')->whereExists(function ($query) {
         $query->select(DB::raw(1))->from('orders')->whereRaw('orders.user_id = users.id');
     })->get();
     //select * from users where exists (select 1 from orders where orders.user_id = users.id)
     //生成上面那句语句  exists 判断括号内语句是否为真  为真则搜索 为假则放弃
 }
示例#12
0
 public function minId()
 {
     $vacancy = DB::table($this->table)->select('min(id)')->first();
     if ($vacancy) {
         return $vacancy->min;
     } else {
         return null;
     }
 }
示例#13
0
 public function getPassedUserIds()
 {
     $arIds = \DB::table('vk_like')->select('to_id')->where(['from_id' => $this->id])->get();
     $arIds = array_map(function ($item) {
         return $item->to_id;
     }, $arIds);
     $arIds[] = $this->id;
     return $arIds;
 }
示例#14
0
 public function generateOrder()
 {
     $max = \DB::table($this->table)->where('parent_id', $this->parent_id)->max('order');
     if (!$max) {
         $this->order = '1';
     } else {
         $this->order = (string) ++$max;
     }
 }
示例#15
0
 public function hasPermission($permission_id)
 {
     $result = 0;
     $result = \DB::table('permissions')->where('user_id', '=', $this->id)->where('permission_id', '=', $permission_id)->count();
     if ($result > 0) {
         return true;
     } else {
         return false;
     }
 }
示例#16
0
 public function completed()
 {
     # total items count of this dataset
     $total = $this->StandardItems()->count() * 3;
     $completed = \DB::table('standard_items')->where('dataset_id', $this->id)->sum('batch_count');
     if ($total == 0) {
         return 100;
     }
     return $completed * 100 / $total;
 }
示例#17
0
 public static function getCountry($ipAddress, $response = 'country_name')
 {
     if ($ipAddress == '127.0.0.1') {
         //localhost
         return 'Ukraine';
     }
     $user_ip = ip2long($ipAddress);
     $query = \DB::table('laravel_ip2country')->where('start_ip_long', '<=', $user_ip)->where('end_ip_long', '>=', $user_ip);
     $results = $query->first();
     return count($results) ? $results->{$response} : '';
 }
 public static function set($key, $value)
 {
     $setting = \DB::table('settings')->where('key', $key);
     if (!$setting->count()) {
         \DB::table('settings')->insert(['key' => $key, 'value' => $value, 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     } else {
         $setting->where('key', $key)->update(['value' => $value, 'updated_at' => \Carbon\Carbon::now()]);
     }
     Cache::forget('settings.' . $key);
     self::writeSelfCache($key, $value);
 }
示例#19
0
 /**
  * The function removes all appointments against a cell
  *
  * @var array
  */
 public function reset($cell)
 {
     $status = 1;
     $cell = trim($cell);
     try {
         \DB::table($this->table)->where('cell', '=', $cell)->delete();
     } catch (\Exception $e) {
         #var_dump($e->errorInfo );
     }
     return $status;
 }
示例#20
0
 /**
  * Получаем объект со всеми виджетами
  * всех позиций
  *
  * @return mixed
  */
 public function getAllWidgets()
 {
     $data = \DB::table('widgets')->get();
     // процесс компоновки объект
     for ($i = 0; $i < count($data); $i++) {
         $obj[$data[$i]->name_location]['active'] = $data[$i]->active;
         for ($j = 0; $j < count((array) json_decode($data[$i]->object_data)); $j++) {
             $obj[$data[$i]->name_location]['types'] = json_decode($data[$i]->object_data);
         }
     }
     return $obj;
 }
示例#21
0
 public function getRolesIdsArr()
 {
     $roles_rows = \DB::table(\Config::get('entrust.role_user_table'))->where('user_id', '=', $this->id)->get(['role_id']);
     if (empty($roles_rows)) {
         return [];
     }
     $roles_ids_arr = [];
     foreach ($roles_rows as $role_row) {
         $roles_ids_arr[] = $role_row->role_id;
     }
     return $roles_ids_arr;
 }
示例#22
0
 public function getPermissionsIdsArr()
 {
     $permissions_rows = \DB::table(\Config::get('entrust.permission_role_table'))->where('role_id', '=', $this->id)->get(['permission_id']);
     if (empty($permissions_rows)) {
         return [];
     }
     $permissions_ids_arr = [];
     foreach ($permissions_rows as $permission_row) {
         $permissions_ids_arr[] = $permission_row->permission_id;
     }
     return $permissions_ids_arr;
 }
示例#23
0
 public static function createSelectbox($team_id)
 {
     $excludePersons = \DB::table('persons_teams')->where('persons_teams.team_id', '=', $team_id)->lists('person_id');
     $persons = array();
     foreach (\DB::table('persons')->orderBy('lastname', 'asc')->get() as $person) {
         if (!in_array($person->id, $excludePersons)) {
             $persons[$person->id] = $person->lastname . ', ' . $person->firstname;
         }
     }
     //if (empty($teams)) return '';
     return Form::select('person', $persons, '', array('class' => 'form-control'));
 }
示例#24
0
 public static function createSelectbox($person_id)
 {
     $excludeTeams = \DB::table('persons_teams')->where('persons_teams.person_id', '=', $person_id)->lists('team_id');
     $teams = array();
     foreach (\DB::table('teams')->orderBy('name', 'asc')->get() as $team) {
         if (!in_array($team->id, $excludeTeams)) {
             $teams[$team->id] = $team->name;
         }
     }
     //if (empty($teams)) return '';
     return Form::select('team', $teams, '', array('class' => 'form-control'));
 }
示例#25
0
 /**
  * 
  * Retrieve tweets of people being followed if they have an tweet id greater than the last
  * id retrieved
  */
 public function getFeed()
 {
     $since_id = \DB::table('social_media')->where('source', '=', 'twitter')->orderBy('social_id', 'DESC')->take(1)->pluck('social_id');
     $paramArr = ['count' => 200, 'include_entities' => 1];
     if ($since_id) {
         $paramArr['since_id'] = $since_id;
     }
     $r = \Twitter::getHomeTimeline($paramArr);
     if (count($r) == 0) {
         return false;
     }
     $socialMediaArr = $this->parseFeed($r);
     return $socialMediaArr;
 }
示例#26
0
 public function head2head($player1, $player2)
 {
     //Match detail
     $matches = \DB::table('matches')->join('tournaments', 'tournaments.tournament_id', '=', 'matches.tournament_id')->join('players as winner', 'winner.player_id', '=', 'matches.player1_id')->join('players as loser', 'loser.player_id', '=', 'matches.player2_id')->where(function ($q) use($player1) {
         $q->where('player1_id', '=', $player1)->orWhere('player2_id', '=', $player1);
     })->where(function ($q) use($player2) {
         $q->where('player1_id', '=', $player2)->orWhere('player2_id', '=', $player2);
     })->orderBy('match_division')->orderBy('round')->select('*', 'winner.first_name as winner_first_name', 'winner.last_name as winner_last_name', 'loser.first_name as loser_first_name', 'loser.last_name as loser_last_name', 'loser.player_id as loser_id', 'tournaments.name as tournament')->distinct()->get();
     //Count wins by player
     $player1_wins = Match::where('winner_id', '=', $player1)->where('player2_id', '=', $player2)->get()->count();
     $player2_wins = Match::where('winner_id', '=', $player2)->where('player2_id', '=', $player1)->get()->count();
     $versus = ['player1' => ['wins' => $player1_wins], 'player2' => ['wins' => $player2_wins], 'matches' => $matches];
     return $versus;
 }
示例#27
0
文件: Tarea.php 项目: ericray/test
 public function scopeAttachAlumno($query, $alumno_id)
 {
     $id = 0;
     if (is_object($alumno_id)) {
         if ($alumno_id->id) {
             $id = $alumno_id->id;
         }
     } elseif (is_integer($alumno_id)) {
         $id = $alumno_id;
     }
     if ($tarea_id = $this->attributes['id']) {
         if (is_integer($id)) {
             \DB::table('tarea_alumno')->insert(['tarea_id' => $tarea_id, 'alumno_id' => $id]);
         } else {
             return false;
         }
     } else {
         return false;
     }
     return true;
 }
示例#28
0
    public function run()
    {
        \DB::table('song_datas')->delete();
        Song_data::create(['song' => 'Example', 'album' => 'Example', 'artist' => 'Example', 'difficulty' => 'Novice', 'view' => 'Specify the tuning, example:
Tuning: Standard(ADGCEA)
Instructions: copy and paste the segment below as much as you need to write a fingerpicking part.
Example:         
e|--------------------------------------------------------------------------|
B|-----------5-------------7-------------5----8----7----5/7--7---------|
G|--------5-------------7-------------5-------9----7----5/7--7---------|
D|-----5-------------7-------------5--------------------------------------|
A|----------------5--------------------------------------------------------|
E|--5---------------------------5------------------------------------------|

"Insert some lyrics here."

If you want to write some part with chords, just put it over the lyrics, like this:
-G-     -B-     -Em-             -F-       -F#-
bla bla.... blablablaa... bla...........yeah

Put the chords between "-" and "-" without cuotes for a correct display.

So you are ready now! Try it!']);
    }
示例#29
0
 public function users()
 {
     return \DB::table('chat')->distinct()->join('users', 'chat.sender_id', '=', 'users.id');
     // ->join('chat', 'receiver_id', '=', $this->id)
 }
 public static function getCanton($id)
 {
     return \DB::table('canton')->where('province_id', $id)->select('canton.id', 'canton.name')->get();
 }