当前位置: 首页>>代码示例>>PHP>>正文


PHP Location::where方法代码示例

本文整理汇总了PHP中app\Location::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::where方法的具体用法?PHP Location::where怎么用?PHP Location::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Location的用法示例。


在下文中一共展示了Location::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update(LocationUpdateRequest $request, $id)
 {
     $location = new Location($request->all());
     Location::where('id', $id)->update($location->getAttributes());
     flash()->success(trans('location.label.name'), trans('location.message_alert.update_success'));
     return redirect('/locations');
 }
开发者ID:vasitjuntong,项目名称:mixed,代码行数:7,代码来源:LocationController.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($type, $id)
 {
     if ($id == 'video') {
         $events = Video::all();
         return view('video.show', compact('events'));
     } elseif ($id == 'staff') {
         $events = Staff::all();
         return view('staff.show', compact('events'));
     } elseif ($id == 'gallery') {
         $events = Image::all();
         return view('gallery.show', compact('events'));
     } else {
         $event = Event::where('slug', $id)->where('type', $type)->first();
         $location = Location::where('event_id', $event->id)->first();
         $slider = EventImage::where('event_id', $event->id)->orderBy(\DB::raw('RAND()'))->take(4)->get();
         $gallery = EventImage::where('event_id', $event->id)->first();
         if ($event->type == $type) {
             if ($event->status == 1) {
                 return view($type . '.show', compact('event', 'location', 'slider', 'gallery'));
             } else {
                 return redirect('/' . $type . '/');
             }
         }
     }
 }
开发者ID:heckyeah,项目名称:ngaitauira,代码行数:31,代码来源:EventController.php

示例3: dashboard_by_location

 /**
  *
  * @return view
  */
 public function dashboard_by_location()
 {
     // summary by location
     $locations = \App\Location::where('parent_id', 0)->orderBy('name')->get();
     for ($i = 0; $i < count($locations); $i++) {
         $nodesAll = \App\Node::where('location_id', $locations[$i]->id)->get();
         $nodesUp = \App\Node::where('location_id', $locations[$i]->id)->where('ping_success', '100')->get();
         $locations[$i]->nodesUp = $nodesUp->count();
         $locations[$i]->nodesDown = $nodesAll->count() - $nodesUp->count();
         // no node assigned in this project
         if ($nodesAll->count() == 0) {
             $locations[$i]->nodesUpnPercent = 0;
             $locations[$i]->nodesDownPercent = 0;
         } else {
             $locations[$i]->nodesUpPercent = $nodesUp->count() / $nodesAll->count() * 100;
             $locations[$i]->nodesDownPercent = 100 - $locations[$i]->nodesUpPercent;
             // to prevent too small click area
             if ($locations[$i]->nodesDownPercent > 0 && $locations[$i]->nodesDownPercent < 10) {
                 $locations[$i]->nodesUpPercent -= 10;
                 $locations[$i]->nodesDownPercent += 10;
             }
             if ($locations[$i]->nodesUpPercent > 0 && $locations[$i]->nodesUpPercent < 10) {
                 $locations[$i]->nodesUpPercent += 10;
                 $locations[$i]->nodesDownPercent -= 10;
             }
         }
     }
     return view('pages.dashboard_by_location', compact('locations'));
 }
开发者ID:afdalwahyu,项目名称:lnms,代码行数:33,代码来源:PagesController.php

示例4: index

 /**
  * Display a list of all locations.
  *
  * @param  Request  $request
  * @return Response
  */
 public function index(Request $request)
 {
     $showLocations = DB::select('select * from configs where id = ?', [2]);
     if ($showLocations[0]->value === '1') {
         return view('locations.index', ['locations' => Location::where('status', 1)->orderBy('name')->get()]);
     } else {
         return view('locations.index', ['locations' => []]);
     }
 }
开发者ID:kellychurchill,项目名称:boothapp,代码行数:15,代码来源:LocationsController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $rp_arr = [];
     $user = \Auth::user();
     if ($user->role->name != 'guest') {
         $data = $request->json()->get('data');
         for ($i = 0; $i < count($data); $i++) {
             $order = new \App\Order();
             $from = Carbon::parse($data[$i]['from']);
             $to = Carbon::parse($data[$i]['to']);
             $order['from'] = $from;
             $order['to'] = $to;
             $order['location_id'] = \App\Location::where('name', $data[$i]['location'])->first()['id'];
             //$order['user_id'] = $user['id'];
             // count the similar records
             // if the num of them reaches upper limite then operation would be aborted
             $num_of_ordered = \App\Order::where('from', $from)->where('to', $to)->where('location_id', $order['location_id'])->count();
             $allowance = \App\Location::findOrFail($order['location_id'])->capacity;
             //dd($num_of_ordered);
             // $num_of_ordered can only be 0 or 1 in this case
             if ($num_of_ordered < $allowance) {
                 $user->orders()->save($order);
                 // Only one vacancy left before the saving statement.
                 if ($allowance - $num_of_ordered <= 1) {
                     array_push($rp_arr, ['from' => $order['from'], 'to' => $order['to'], 'status' => '0']);
                 } else {
                     array_push($rp_arr, ['from' => $order['from'], 'to' => $order['to'], 'status' => '1']);
                 }
             }
             /*else {
                   array_push($rp_arr, ['from' => $order['from'], 'to' => $order['to'], 'status' => '0']);
               }*/
         }
         /*if (\Auth::user()->orders()->save($order)) {
         
                         // \Mail::send('emails.test', [], function ($m) {
                         //     $m->from('soniczhangss@gmail.com', 'sonic');
                         //     $m->to('soniczhangss@gmail.com', 'sonic')->subject('Your Reminder!');
                         // });
                             return back()->withInput();
         
                         // $headers = 'From: soniczhangss@gmail.com' . "\r\n" . 'Reply-To: soniczhangss@gmail.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
                         // if (mail('soniczhangss@gmail.com', 'My Subject', 'blah blah', $headers)) {
                         //     return response()->json(['response' => 'successful']);
                         // } else {
                         //     return response()->json(['response' => 'failed']);
                         // }
                         //dd(mail('soniczhangss@gmail.com', 'My Subject', 'blah blah', $headers));
                         
                         //return response()->json(['response' => 'successful']);
                         
                     }*/
     }
     //return back()->withInput();
     return response()->json(['data' => $rp_arr]);
 }
开发者ID:soniczhangss,项目名称:Ordering-System,代码行数:62,代码来源:OrdersController.php

示例6: showLocations

 public function showLocations(Request $request)
 {
     $q = $request->input('q');
     $json['results'] = [];
     $results = Location::where('name', 'LIKE', "%{$q}%")->take(10)->lists('name', 'id');
     foreach ($results as $key => $value) {
         $json['results'][] = array('id' => $key, 'text' => $value);
     }
     return json_encode($json);
 }
开发者ID:gfdeveloper,项目名称:LCCB,代码行数:10,代码来源:ApiController.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $travel_id = Request::input('travel_id');
     $locations = Location::where('travel_id', $travel_id)->orderBy('order', 'asc')->get();
     if (count($locations) > 0) {
         return $locations;
     } else {
         return [];
     }
 }
开发者ID:shana0440,项目名称:DreamSupport,代码行数:15,代码来源:LocationsController.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Session::has('currency')) {
         return $next($request);
     }
     $ip = $_SERVER['REMOTE_ADDR'];
     $data = \SypexGeo::get($ip);
     $currency = 'BYR';
     if (isset($data['country']['iso'])) {
         switch ($data['country']['iso']) {
             case 'KZ':
             case 'RU':
                 $currency = 'RUB';
                 break;
             case 'BY':
                 $currency = 'BYR';
                 break;
                 //Euro zone countries
             //Euro zone countries
             case 'AT':
             case 'BE':
             case 'DE':
             case 'GR':
             case 'IE':
             case 'IT':
             case 'ES':
             case 'CY':
             case 'LV':
             case 'LT':
             case 'LU':
             case 'MT':
             case 'NL':
             case 'PT':
             case 'SK':
             case 'SI':
             case 'FI':
             case 'FR':
             case 'EE':
                 $currency = 'EUR';
                 break;
             case 'GB':
                 $currency = 'GBP';
                 break;
             default:
                 $currency = 'USD';
                 break;
         }
     }
     Session::put('currency', $currency);
     $isInBase = \App\Location::where('ip', $ip)->twentyFour()->first();
     if (!$isInBase) {
         \App\Location::create(['ip' => $ip]);
     }
     return $next($request);
 }
开发者ID:Qeenslet,项目名称:wireworks,代码行数:62,代码来源:Locator.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $ip = $_SERVER['REMOTE_ADDR'];
     $isInBase = \App\Location::where('ip', $ip)->twentyFour()->first();
     if (!$isInBase) {
         $data = \SypexGeo::get($ip);
         $sData = serialize($data);
         $visitor = \App\Location::create(['ip' => $ip, 'content' => $sData]);
     }
     return $next($request);
 }
开发者ID:Qeenslet,项目名称:elite-lara,代码行数:18,代码来源:Locator.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $q = \Request::get('q');
     if ($q != '') {
         $locations = \App\Location::where('name', 'RLIKE', $q)->where('id', '>', 1)->paginate(200);
     } else {
         $locations = \App\Location::where('id', '>', 1)->paginate(200);
     }
     return view('locations.index', compact('locations', 'q'));
 }
开发者ID:afdalwahyu,项目名称:lnms,代码行数:16,代码来源:LocationsController.php

示例11: map

 public function map($location_id)
 {
     $oLocation = Location::where('id', '=', $location_id)->first();
     if (!$oLocation) {
         return '<center><h1>Locación no valida :P</h1></center>';
     } else {
         $valores['latitude'] = (double) $oLocation->latitude;
         $valores['longitude'] = (double) $oLocation->longitude;
         $valores['date'] = $oLocation->date;
         return view('map', compact('valores'));
     }
 }
开发者ID:jbernaljbc,项目名称:api,代码行数:12,代码来源:LocationController.php

示例12: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request)
 {
     $data = $request->json()->get('data');
     $locationOld = $data[0]['locationOld'];
     $location = $data[0]['location'];
     $allowance = $data[0]['allowance'];
     $locationRec = \App\Location::where('name', $locationOld);
     if ($allowance == '') {
         $locationRec->update(['name' => $location]);
     } else {
         $locationRec->update(['name' => $location, 'capacity' => $allowance]);
     }
 }
开发者ID:soniczhangss,项目名称:Ordering-System,代码行数:20,代码来源:LocationController.php

示例13: zipcode

 /**
  * Query by zipcode
  * @param  string $zipcode 5 digit zipcode - validated in route
  * @return json
  */
 public function zipcode($zipcode)
 {
     $resp = new \stdClass();
     $l = Location::where('zip', intval($zipcode))->first();
     if (null === $l) {
         return ['status' => 'error', 'message' => 'zipcode not found'];
     }
     $reps = Representative::atLocation($l);
     usort($reps, 'rankSort');
     $resp->reps = $reps;
     $resp->location = $l;
     return response()->json($resp);
 }
开发者ID:edfialk,项目名称:ContactMyReps,代码行数:18,代码来源:RepresentativeController.php

示例14: all_select

 /**
  * Generate Location Associate Array
  *
  * @return Array
  */
 public static function all_select($show_all = '')
 {
     $_ret = array();
     $_ret[''] = '-- location --';
     if ($show_all == 'all') {
         $_ret[1] = '** ALL **';
     }
     $locations = \App\Location::where('id', '>', 1)->get();
     foreach ($locations as $location) {
         $_ret[$location->id] = $location->name;
     }
     return $_ret;
 }
开发者ID:afdalwahyu,项目名称:lnms,代码行数:18,代码来源:Location.php

示例15: searchLocationTweets

 public static function searchLocationTweets($locName, $locLat, $locLng)
 {
     $location = Location::where('latitude', '=', round($locLat, 7))->where('longitude', '=', round($locLng, 7))->first();
     $tweets = null;
     if ($location == null) {
         $location = new Location();
         $location->name = $locName;
         $location->latitude = round($locLat, 7);
         $location->longitude = round($locLng, 7);
         $locRet = $location->save();
         //save search history
         $search = new Search();
         $search->location_id = $location->id;
         $search->user = $_COOKIE['user'];
         $search->save();
         $tweets = self::getTweets($locName, round($locLat, 7), round($locLng, 7));
         //save tweets
         foreach ($tweets as $tweet) {
             $tweet->search_id = $search->id;
             $tweet->save();
         }
     } else {
         $search = Search::where('location_id', '=', $location->id)->orderBy('created_at', 'desc')->first();
         $searchTime = strtotime($search->created_at);
         //save new search
         $newSearch = new Search();
         $newSearch->location_id = $location->id;
         $newSearch->user = $_COOKIE['user'];
         $newSearch->save();
         //if search is older than 1 hour, tweet again
         if ($searchTime <= strtotime('-' . Config::get('app.cache_duration') . ' minutes')) {
             $tweets = self::getTweets($locName, round($locLat, 7), round($locLng, 7));
             //save tweets
             foreach ($tweets as $tweet) {
                 $tweet->search_id = $search->id;
                 $tweet->save();
             }
         } else {
             //get last search with tweets
             $search = DB::table('searches')->where('location_id', '=', $location->id)->whereExists(function ($query) {
                 $query->select(DB::raw(1))->from('tweets')->whereRaw('tweets.search_id = searches.id');
             })->orderBy('created_at', 'desc')->first();
             $tweets = Tweet::where('search_id', '=', $search->id)->get();
         }
     }
     return $tweets;
 }
开发者ID:henrique-lima,项目名称:rabbit-internet,代码行数:47,代码来源:TwitterServices.php


注:本文中的app\Location::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。