/** * 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(); }
/** * 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); } }
/** * 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); }
/** * 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')); }
/** * 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')); }
<?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); } }
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(); }
public function index() { $events = Event::all(); return $events; }
<?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());