本文整理汇总了PHP中app\Event::take方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::take方法的具体用法?PHP Event::take怎么用?PHP Event::take使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Event
的用法示例。
在下文中一共展示了Event::take方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Show the application welcome screen to the user.
*
* @return Response
*/
public function index()
{
$events = Event::take('4')->get();
$authors = Author::take('4')->get();
$coverage = DB::table('press')->take('4')->orderBy('press_date', 'desc')->get();
return view('welcome', compact('events', 'authors', 'coverage'));
}
示例2: index
/**
* Show the application dashboard.
*
* @return Response
*/
public function index()
{
try {
$isInstalled = Setting::where('name', 'is_installed')->firstOrFail();
} catch (ModelNotFoundException $e) {
$isInstalled = Setting::create(['name' => 'is_installed', 'setting' => 'no']);
}
if ($isInstalled->setting != 'yes') {
return Redirect::route('install');
}
$data = ["event" => Event::first(), "upcomingEvents" => Event::take(3)->get(), "news" => News::take(6)->get(), "media" => Media::where('processed', true)->orderBy('id', 'DESC')->take(12)->get()];
return view('home')->with($data);
}
示例3: scanIsInsideParcel
public function scanIsInsideParcel()
{
$this->middleware('auth');
$pointLocation = new PointLocation();
$events = Event::take(1000)->orderBy('dateGps', 'ASC')->get();
foreach ($events as $key => $value) {
$latLonEvent = $value->lat . "," . $value->lon;
$event = $value;
$parcels = Parcel::orderByRaw('lat - ' . $value->lat . '', 'ASC')->take(20)->get();
foreach ($parcels as $key => $value) {
$isPointInside = 0;
$parcelsGps = ParcelGps::where('idparcel', $value->id)->orderBy('number', 'ASC')->get();
$polygon = array();
foreach ($parcelsGps as $key => $value) {
$latlng = "" . $value->lat . ", " . $value->long . "";
$idparcelEvent = $value->idparcel;
array_push($polygon, $latlng);
}
$isPointInside = $pointLocation->pointInPolygon($latLonEvent, $polygon, $event, $idparcelEvent);
if ($isPointInside == 1) {
$event = Event::find($event->id);
$event->isSync = 1;
$event->isInside = 1;
$event->idParcelle = $idparcelEvent;
$event->save();
$eventprocessed = new ProcessedEvents();
$eventprocessed->idApp = $event->idApp;
$eventprocessed->idUser = $event->idUser;
$eventprocessed->name = $event->name;
$eventprocessed->lon = $event->lon;
$eventprocessed->lat = $event->lat;
$eventprocessed->dateGps = $event->dateGps;
$eventprocessed->timeDate = $event->timeDate;
$eventprocessed->isInside = $event->isInside;
$eventprocessed->idParcelle = $event->idParcelle;
$eventprocessed->altitude = $event->altitude;
$eventprocessed->isSync = $event->isSync;
$eventprocessed->save();
break;
}
if ($isPointInside == 0) {
$event = Event::find($event->id);
$event->isSync = 1;
$event->isInside = 0;
$event->idParcelle = 0;
$event->save();
}
}
}
}
示例4: showParcelsEvents
public function showParcelsEvents()
{
$events = Event::take(100)->get();
$users = User::all();
$parcels = Parcel::all();
$parcelsGpsArray = [];
foreach ($parcels as $key => $value) {
$parcelsGps = ParcelGps::where('idparcel', $value->id)->orderBy('number')->select('lat', 'long')->get();
array_push($parcelsGpsArray, $parcelsGps);
}
// load the view and pass the parcels
return View::make('app.parcel.showevent')->with('parcels', $parcelsGpsArray)->with('events', $events)->with('users', $users);
}
示例5: getListEvents
public function getListEvents()
{
$events = Event::take(2);
return $events;
}