/** * Run the database seeds. * * @return void */ public function run() { foreach (range(1, 25) as $index) { $table = new Table(); $table->number_of_seats = 6; $table->table_name = 'Table ' . $index; $table->room_id = 1; $table->table_type_id = 2; $table->width = 6; $table->length = 6; $table->save(); } }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request, $eventId) { $input = Input::except('token'); $roomId = Event::find($eventId)->room->id; $tableType = $table = new Table(); $validator = $table->getValidator($input); if ($validator->fails()) { return $this->respondInvalidData($validator->errors()); } $table->fill($input); $table->room_id = $roomId; $table->save(); return $this->respondCreateSuccess('Table: ' . $table->table_name . ' created'); }