/** * Run the database seeds. * * @return void */ public function run() { $guestChunks = Guest::all()->chunk(6, true); foreach ($guestChunks as $index => $chunk) { $table = Table::find($index + 1); foreach ($chunk as $guest) { $table->seatGuest($guest); } } }
/** * Run the database seeds. * * @return void */ public function run() { foreach (Guest::all() as $guest) { $itemChoice = rand(1, 3); $guestMenuItem = new GuestMenuItem(); $guestMenuItem->guest_id = $guest->id; $guestMenuItem->menu_item_id = $itemChoice; $guestMenuItem->save(); } }
public function get_guestrequests() { $count = Guest::all()->count(); $guests = Guest::all(); $packages = Package::all(); if ($count == 0) { return View('exam.main.admin.guests')->withtitle('Admin | Dashboard')->withpackages($packages); } else { return View('exam.main.admin.guests')->withtitle('Admin | Dashboard')->withpackages($packages)->withguests($guests); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { try { $response = ['guest' => []]; $statusCode = 200; $data = Guest::all(); //$users = User::all()->take(9); foreach ($data as $d) { $response['guest'][] = ['id' => $d->id, 'name' => $d->name, 'description' => $d->description]; } } catch (Exception $e) { $statusCode = 404; } finally { return Response::json($response['guest'], $statusCode); } }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create(); foreach (range(1, 150) as $index) { $guest = new Guest(); $guest->email = $faker->email; $guest->first_name = $faker->firstName; $guest->last_name = $faker->lastName; $guest->event_id = 1; if (Guest::all()->count() > 0) { if (is_int($index / 10)) { $guest->plus_one = $index - 1; } } $guest->save(); if (is_int($index / 30)) { $gdr = new GuestDietaryRestriction(); $gdr->guest_id = $guest->id; $gdr->dietary_restriction_id = rand(1, 3); $gdr->save(); } } }
public function getGuest() { try { $response = []; $statusCode = 200; $guest = Guest::all(); foreach ($guest as $a) { $response[] = ['id' => $a->id, 'value' => $a->name . ' (' . $a->description . ')']; } } catch (Exception $e) { $statusCode = 404; } finally { return Response::json($response, $statusCode); } }