Compare commits
No commits in common. "c6d4c3df1049f39509703532a8eb2d5d758de3ba" and "830a950bf405bac5a41bd8f8211261bbcd3659d8" have entirely different histories.
c6d4c3df10
...
830a950bf4
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddStatusToTicketsTable extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('tickets');
|
||||
$table->addColumn('status', 'string', ['null' => false, 'default' => 'open'])
|
||||
->update();
|
||||
}
|
||||
}
|
@ -9,15 +9,6 @@ use BitGoblin\Goliath\Models\Ticket;
|
||||
|
||||
class TicketController extends Controller {
|
||||
|
||||
public function getView(Request $request, Response $response, array $args): Response {
|
||||
$ticket = Ticket::where('id', $args['ticket_id'])->get();
|
||||
|
||||
$view = Twig::fromRequest($request);
|
||||
return $view->render($response, 'ticket/view.twig', [
|
||||
'ticket' => $ticket[0],
|
||||
]);
|
||||
}
|
||||
|
||||
public function getCreate(Request $request, Response $response): Response {
|
||||
$view = Twig::fromRequest($request);
|
||||
return $view->render($response, 'ticket/create.twig');
|
||||
|
@ -10,6 +10,3 @@ $app->get('/', '\\BitGoblin\\Goliath\\Controllers\\HomeController:getIndex')->se
|
||||
// /ticket/create GET route - allows a user to fill out a form to create a ticket
|
||||
$app->get('/ticket/create', '\\BitGoblin\\Goliath\\Controllers\\TicketController:getCreate')->setName('ticket.create');
|
||||
$app->post('/ticket/create', '\\BitGoblin\\Goliath\\Controllers\\TicketController:postCreate');
|
||||
|
||||
// /ticket/id route - displays ticket info to user
|
||||
$app->get('/ticket/{ticket_id}', '\\BitGoblin\\Goliath\\Controllers\\TicketController:getView')->setName('ticket.view');
|
||||
|
@ -19,7 +19,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for ticket in tickets %}
|
||||
<td><a href="{{ url_for('ticket.view', {ticket_id: ticket.id}) }}">{{ ticket.title }}</a></td>
|
||||
<td>{{ ticket.title }}</td>
|
||||
<td>{{ ticket.severity }}</td>
|
||||
<td>{{ ticket.due_at }}</td>
|
||||
{% endfor %}
|
||||
|
@ -1,21 +0,0 @@
|
||||
{% extends 'layout.twig' %}
|
||||
|
||||
{% block title %}Home{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="columns twelve">
|
||||
<h1>{{ ticket.title }}</h1>
|
||||
<h4 class="ticket-status">Status: {{ ticket.status }}</h4>
|
||||
<h5 class="ticket-created">Created at {{ ticket.created_at }} | Last updated at {{ ticket.updated_at }}</h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns twelve">
|
||||
<p>{{ ticket.body }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user