From b49dcfabe396b23b02e2f41b7468860906c78f00 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Tue, 1 Nov 2016 17:53:51 -0400 Subject: [PATCH] 1.3 - Getting to Green --- app/Concert.php | 11 +++++ app/Http/Controllers/ConcertsController.php | 15 +++++++ ...016_11_01_200307_create_concerts_table.php | 41 +++++++++++++++++++ phpunit.xml | 2 + resources/views/concerts/show.blade.php | 9 ++++ routes/web.php | 4 +- tests/features/ViewConcertListingTest.php | 4 ++ 7 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 app/Concert.php create mode 100644 app/Http/Controllers/ConcertsController.php create mode 100644 database/migrations/2016_11_01_200307_create_concerts_table.php create mode 100644 resources/views/concerts/show.blade.php diff --git a/app/Concert.php b/app/Concert.php new file mode 100644 index 0000000..bf2bd1d --- /dev/null +++ b/app/Concert.php @@ -0,0 +1,11 @@ + $concert]); + } +} diff --git a/database/migrations/2016_11_01_200307_create_concerts_table.php b/database/migrations/2016_11_01_200307_create_concerts_table.php new file mode 100644 index 0000000..fa5f69c --- /dev/null +++ b/database/migrations/2016_11_01_200307_create_concerts_table.php @@ -0,0 +1,41 @@ +increments('id'); + $table->string('title'); + $table->string('subtitle'); + $table->datetime('date'); + $table->integer('ticket_price'); + $table->string('venue'); + $table->string('venue_address'); + $table->string('city'); + $table->string('state'); + $table->string('zip'); + $table->text('additional_information'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('concerts'); + } +} diff --git a/phpunit.xml b/phpunit.xml index 712e0af..7ff7452 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -23,5 +23,7 @@ + + diff --git a/resources/views/concerts/show.blade.php b/resources/views/concerts/show.blade.php new file mode 100644 index 0000000..9405722 --- /dev/null +++ b/resources/views/concerts/show.blade.php @@ -0,0 +1,9 @@ +

{{ $concert->title }}

+

{{ $concert->subtitle }}

+

{{ $concert->date->format('F j, Y') }}

+

Doors at {{ $concert->date->format('g:ia') }}

+

{{ number_format($concert->ticket_price / 100, 2) }}

+

{{ $concert->venue }}

+

{{ $concert->venue_address }}

+

{{ $concert->city }}, {{ $concert->state }} {{ $concert->zip }}

+

{{ $concert->additional_information }}

diff --git a/routes/web.php b/routes/web.php index 810aa34..c3ef6cb 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,6 +11,4 @@ | */ -Route::get('/', function () { - return view('welcome'); -}); +Route::get('/concerts/{id}', 'ConcertsController@show'); diff --git a/tests/features/ViewConcertListingTest.php b/tests/features/ViewConcertListingTest.php index 705b115..0ee6629 100644 --- a/tests/features/ViewConcertListingTest.php +++ b/tests/features/ViewConcertListingTest.php @@ -1,11 +1,15 @@