本文整理汇总了PHP中app\models\Event::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::all方法的具体用法?PHP Event::all怎么用?PHP Event::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Event
的用法示例。
在下文中一共展示了Event::all方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$room = new Room();
$room->event_id = Event::all()->first()->id;
$room->length = 200;
$room->width = 400;
//need 25 tables of 6 people
$room->save();
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
foreach (Conference::all() as $conference) {
$conference->managers()->attach(1);
}
foreach (Event::all() as $event) {
$event->managers()->attach(1);
}
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
$events = Event::all();
$response = new \stdClass();
$response->success = true;
$response->total = count($events);
$response->data = $events;
return response()->json($response);
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$events = Event::all();
$event_arr = array();
foreach ($events as $key => $value) {
$item = array('id' => $value->id, 'title' => $value->title, 'start' => $value->start, 'end' => $value->end);
array_push($event_arr, $item);
}
$event_json = json_encode($event_arr);
return view('events.calendars', compact('event_json'));
}
示例5: showSales
/**
* Display the specified resource.
*
* @return \Illuminate\Http\Response
*/
public function showSales()
{
$events = Event::all();
$tickets = Ticket::all();
$eventInformation = [];
foreach ($events as $event) {
// pueden ser muchos eventos. Necesito información para llenar la tabla
$eventsDate = Presentation::where('event_id', '=', $event->id)->where('cancelled', '=', 0)->get();
foreach ($eventsDate as $eventDate) {
$tickets = Ticket::where('presentation_id', '=', $eventDate->id)->get();
$onlineTickets = 0;
$presentialTicket = 0;
$subTotalOnline = 0;
$subTotalPresential = 0;
foreach ($tickets as $ticket) {
if ($ticket->cancelled != 1) {
if (empty($ticket->salesman_id)) {
$onlineTickets = $onlineTickets + $ticket->quantity;
$subTotalPresential = $subTotalPresential + $ticket->total_price;
} else {
$presentialTicket = $presentialTicket + $ticket->quantity;
$subTotalOnline = $subTotalOnline + $ticket->total_price;
}
}
}
array_push($eventInformation, array($event->name, $eventDate->id, date("d/m/Y", $eventDate->starts_at), $onlineTickets, $subTotalPresential, $presentialTicket, $subTotalOnline, $subTotalPresential + $subTotalOnline));
}
}
//
//return $eventInformation;
return view('internal.admin.reports.sales', compact('eventInformation'));
}
示例6: createEvents
<?php
/**
* Created by PhpStorm.
* User: criativa
* Date: 24/09/15
* Time: 13:50
*/
require_once 'vendor/autoload.php';
require_once 'config/database.php';
use App\Models\Event;
require_once 'migrate.php';
$events = [["dia" => "24/10", "horario" => "9:00 ~ 12:00", "vagas" => 300], ["dia" => "24/10", "horario" => "14:00 ~ 17:00", "vagas" => 300], ["dia" => "25/10", "horario" => "9:00 ~ 12:00", "vagas" => 300], ["dia" => "25/10", "horario" => "14:00 ~ 17:00", "vagas" => 300]];
if (Event::all()->count() < count($events)) {
createEvents($events);
}
function createEvents($events)
{
foreach ($events as $event) {
Event::create($event);
}
}
示例7: generateCalendar
public function generateCalendar(Request $request)
{
$vCalendar = new Calendar('www.boilermake.org');
$events = Event::all();
// Iterate through all events
foreach ($events as $event) {
$vEvent = new \Eluceo\iCal\Component\Event();
$vEvent->setDtStart(new \DateTime($event->begin))->setDtEnd(new \DateTime($event->end))->setNoTime(true)->setSummary($event->title);
$vCalendar->addComponent($vEvent);
}
// Headers that might not actually do anything
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
//date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
//tell it we just updated
header('Cache-Control: no-store, no-cache, must-revalidate');
//force revaidation
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="cal.ics"');
echo $vCalendar->render();
}
示例8: index
public function index()
{
$events = Event::all();
return $events;
}
示例9: json_encode
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
require_once 'vendor/autoload.php';
require_once 'config/database.php';
use App\Models\Event;
header("Access-Control-Allow-Origin: *");
echo json_encode(Event::all()->toArray());