fully working tests both phpunit and dusk
This commit is contained in:
@@ -86,54 +86,10 @@ final class TicketCreate extends Component
|
||||
$this->applyDefaults();
|
||||
}
|
||||
|
||||
public function save(TicketService $tickets)
|
||||
{
|
||||
logger()->info('SAVE START');
|
||||
|
||||
try {
|
||||
|
||||
logger()->info('VALIDATING');
|
||||
|
||||
$this->validate();
|
||||
|
||||
logger()->info('VALIDATED');
|
||||
|
||||
logger()->info([
|
||||
'attachments' => count($this->attachments),
|
||||
'body' => $this->body,
|
||||
]);
|
||||
|
||||
$ticket = $tickets->create(Auth::user(), [
|
||||
'company_id' => $this->company_id,
|
||||
'subject' => $this->subject,
|
||||
'body' => $this->body,
|
||||
'board_id' => $this->board_id,
|
||||
'priority_id' => $this->priority_id,
|
||||
'category_id' => $this->category_id,
|
||||
'project_id' => $this->project_id,
|
||||
'product_id' => $this->product_id,
|
||||
'team_id' => $this->team_id,
|
||||
'due_at' => $this->due_at,
|
||||
'tag_ids' => $this->tag_ids,
|
||||
], $this->attachments);
|
||||
session()->flash('success', 'Ticket ' . $ticket->reference . ' has been created.');
|
||||
|
||||
logger()->info('CREATED '.$ticket->id);
|
||||
|
||||
return redirect()->route('helpdesk.tickets.index');
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
logger()->error($e);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a new helpdesk ticket.
|
||||
*/
|
||||
public function save_old(TicketService $tickets)
|
||||
public function save(TicketService $tickets)
|
||||
{
|
||||
if ($this->isSaving) {
|
||||
return null;
|
||||
@@ -159,7 +115,9 @@ final class TicketCreate extends Component
|
||||
'due_at' => $this->due_at,
|
||||
'tag_ids' => $this->tag_ids,
|
||||
], $this->attachments);
|
||||
|
||||
session()->flash('success', 'Ticket ' . $ticket->reference . ' has been created.');
|
||||
|
||||
return redirect()->to(route('helpdesk.tickets.index'));
|
||||
} finally {
|
||||
$this->isSaving = false;
|
||||
|
||||
Reference in New Issue
Block a user