mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 03:04:05 +00:00
(add template and routing for message attendees form)
This commit is contained in:
17
app/Http/Controllers/Backstage/ConcertMessagesController.php
Normal file
17
app/Http/Controllers/Backstage/ConcertMessagesController.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backstage;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ConcertMessagesController extends Controller
|
||||
{
|
||||
public function create($id)
|
||||
{
|
||||
$concert = Auth::user()->concerts()->findOrFail($id);
|
||||
|
||||
return view('backstage.concert-messages.new', ['concert' => $concert]);
|
||||
}
|
||||
}
|
||||
563
composer.lock
generated
563
composer.lock
generated
File diff suppressed because it is too large
Load Diff
54
resources/views/backstage/concert-messages/new.blade.php
Normal file
54
resources/views/backstage/concert-messages/new.blade.php
Normal file
@@ -0,0 +1,54 @@
|
||||
@extends('layouts.backstage')
|
||||
|
||||
@section('backstageContent')
|
||||
<div class="bg-light p-xs-y-4 border-b">
|
||||
<div class="container">
|
||||
<div class="flex-spaced flex-y-center">
|
||||
<h1 class="text-lg">
|
||||
<strong class="wt-medium">{{ $concert->title }}</strong>
|
||||
<span class="m-xs-x-2 text-dark-muted">/</span>
|
||||
<span class="wt-normal text-dark-soft text-base">
|
||||
{{ $concert->formatted_date }}
|
||||
</span>
|
||||
</h1>
|
||||
<div class="text-base">
|
||||
<a href="{{ route('backstage.published-concert-orders.index', $concert) }}" class="inline-block m-xs-r-4">
|
||||
Orders
|
||||
</a>
|
||||
<a href="{{ route('backstage.concert-messages.new', $concert) }}" class="wt-bold inline-block">
|
||||
Message Attendees
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-soft p-xs-y-5">
|
||||
<div class="container m-xs-b-4">
|
||||
<div class="constrain constrain-lg m-xs-auto">
|
||||
<h1 class="text-xl wt-light text-center m-xs-b-4 text-dark">New Message</h1>
|
||||
|
||||
@if (session()->has('flash'))
|
||||
<div class="alert alert-success m-xs-b-4">Message sent!</div>
|
||||
@endif
|
||||
|
||||
<div class="card p-xs-6">
|
||||
<form action="#" method="POST">
|
||||
{{ csrf_field() }}
|
||||
<div class="form-group">
|
||||
<label class="form-label">Subject</label>
|
||||
<input name="subject" class="form-control" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Message</label>
|
||||
<textarea class="form-control" name="message" rows="10" required></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-primary btn-block text-smooth">Send Now</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -12,9 +12,12 @@
|
||||
</span>
|
||||
</h1>
|
||||
<div class="text-base">
|
||||
<a href="{{ route('backstage.published-concert-orders.index', $concert) }}" class="wt-bold inline-block">
|
||||
<a href="{{ route('backstage.published-concert-orders.index', $concert) }}" class="wt-bold inline-block m-xs-r-4">
|
||||
Orders
|
||||
</a>
|
||||
<a href="{{ route('backstage.concert-messages.new', $concert) }}" class="inline-block">
|
||||
Message Attendees
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,5 +28,7 @@ Route::group(['middleware' => 'auth', 'prefix' => 'backstage', 'namespace' => 'B
|
||||
|
||||
Route::post('/published-concerts', 'PublishedConcertsController@store')->name('backstage.published-concerts.store');
|
||||
Route::get('/published-concerts/{id}/orders', 'PublishedConcertOrdersController@index')->name('backstage.published-concert-orders.index');
|
||||
|
||||
Route::get('/concerts/{id}/messages/new', 'ConcertMessagesController@create')->name('backstage.concert-messages.new');
|
||||
});
|
||||
|
||||
|
||||
53
tests/Feature/Backstage/MessageAttendeesTest.php
Normal file
53
tests/Feature/Backstage/MessageAttendeesTest.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Backstage;
|
||||
|
||||
use App\User;
|
||||
use ConcertFactory;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
|
||||
class MessageAttendeesTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
/** @test */
|
||||
function a_promoter_can_view_the_message_form_for_their_own_concert()
|
||||
{
|
||||
$this->disableExceptionHandling();
|
||||
|
||||
$user = factory(User::class)->create();
|
||||
$concert = ConcertFactory::createPublished([
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)->get("/backstage/concerts/{$concert->id}/messages/new");
|
||||
|
||||
$response->assertStatus(200);
|
||||
$response->assertViewIs('backstage.concert-messages.new');
|
||||
$this->assertTrue($response->data('concert')->is($concert));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function a_promoter_cannot_view_the_message_form_for_another_concert()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
$concert = ConcertFactory::createPublished([
|
||||
'user_id' => factory(User::class)->create(),
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)->get("/backstage/concerts/{$concert->id}/messages/new");
|
||||
|
||||
$response->assertStatus(404);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function a_guest_cannot_view_the_message_form_for_any_concert()
|
||||
{
|
||||
$concert = ConcertFactory::createPublished();
|
||||
|
||||
$response = $this->get("/backstage/concerts/{$concert->id}/messages/new");
|
||||
|
||||
$response->assertRedirect('/login');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user