-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from devaslanphp/dev
Tickets numbers
- Loading branch information
Showing
20 changed files
with
233 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Ticket; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Support\Str; | ||
|
||
class TicketNumberController extends Controller | ||
{ | ||
|
||
/** | ||
* Redirect to a ticket based on it's number | ||
* | ||
* @param string $number | ||
* @return RedirectResponse|void | ||
*/ | ||
public function __invoke(string $number) | ||
{ | ||
$ticket_prefix = substr($number, 0, 4); | ||
$ticket_number = str_replace($ticket_prefix, "", $number); | ||
$ticket = Ticket::where('number', $ticket_number) | ||
->whereHas('project', fn($query) => $query->where('ticket_prefix', $ticket_prefix)) | ||
->first(); | ||
if ($ticket) { | ||
return redirect()->route('tickets.details', [ | ||
'ticket' => $ticket, | ||
'slug' => Str::slug($ticket->title) | ||
]); | ||
} else { | ||
abort(404); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,16 +13,16 @@ VALUES (4, 'Dark Vador', '[email protected]', NULL, '$2y$10$4f8HPTwKhVzpAP5kas | |
'$2y$10$MR51TVg3xzUXs308oTxp8.Pw9sjs7ijaeGYLJZsq85CdY/azYD0bG', NULL, '2022-09-11 15:31:51', | ||
'2022-09-11 15:31:55', 'employee', '82c93eba-9a33-4dbe-abac-22f11f5c1f54', NULL); | ||
|
||
INSERT INTO `projects` (`id`, `name`, `description`, `owner_id`, `deleted_at`, `created_at`, `updated_at`) | ||
INSERT INTO `projects` (`id`, `name`, `description`, `owner_id`, `deleted_at`, `created_at`, `updated_at`, `ticket_prefix`) | ||
VALUES (1, 'Default project', | ||
'<p>This is the default project to associate to any created ticket that are not related to any other projects.</p>', | ||
4, NULL, '2022-09-11 16:29:08', '2022-09-11 16:35:48'), | ||
4, NULL, '2022-09-11 16:29:08', '2022-09-11 16:35:48', 'DEFP'), | ||
(2, 'IDEAO', '<p>Project for managing tickets linked to the IDEAO project</p>', 4, NULL, '2022-09-11 17:09:31', | ||
'2022-09-11 17:12:47'), | ||
'2022-09-11 17:12:47', 'IDEA'), | ||
(3, 'Arena job', '<p>Project for managing tickets linked to the Arena job project</p>', 4, NULL, | ||
'2022-09-11 17:13:05', '2022-09-11 17:13:17'), | ||
'2022-09-11 17:13:05', '2022-09-11 17:13:17', 'ARJO'), | ||
(4, 'ARP', '<p>Project for managing tickets linked to the ARP project</p>', 5, NULL, '2022-09-11 17:13:25', | ||
'2022-09-11 17:15:04'); | ||
'2022-09-11 17:15:04', 'ARPT'); | ||
|
||
INSERT INTO `favorite_projects` (`id`, `user_id`, `project_id`, `created_at`, `updated_at`) | ||
VALUES (6, 4, 2, '2022-09-11 17:09:33', '2022-09-11 17:09:33'), | ||
|
@@ -31,17 +31,17 @@ VALUES (6, 4, 2, '2022-09-11 17:09:33', '2022-09-11 17:09:33'), | |
(11, 4, 1, '2022-09-12 11:50:42', '2022-09-12 11:50:42'); | ||
|
||
INSERT INTO `tickets` (`id`, `title`, `content`, `status`, `priority`, `owner_id`, `responsible_id`, `deleted_at`, | ||
`created_at`, `updated_at`, `project_id`, `type`) | ||
`created_at`, `updated_at`, `project_id`, `type`, `number`) | ||
VALUES (2, 'Cannot access the platform', | ||
'<p>Hello,</p><p>I cannot access the platform with the credentials received by email.</p><p>Can you see what is the problem, please?</p><p>Thanks</p>', | ||
'validated', 'highest', 4, 5, NULL, '2022-09-11 18:27:55', '2022-09-12 11:48:00', 1, 'bug'), | ||
'validated', 'highest', 4, 5, NULL, '2022-09-11 18:27:55', '2022-09-12 11:48:00', 1, 'bug', '0001'), | ||
(3, 'Design enhancement', '<p>Add a logo of the company to the login page.</p>', 'created', 'low', 5, 4, NULL, | ||
'2022-09-11 18:45:55', '2022-09-12 13:08:05', 2, 'improvement'), | ||
'2022-09-11 18:45:55', '2022-09-12 13:08:05', 2, 'improvement', '0001'), | ||
(4, 'Quiz wizard', '<p>Add a wizard system to the quiz page</p>', 'created', 'normal', 4, NULL, NULL, | ||
'2022-09-11 20:37:14', '2022-09-11 20:37:14', 2, 'improvement'), | ||
'2022-09-11 20:37:14', '2022-09-11 20:37:14', 2, 'improvement', '0002'), | ||
(9, 'Internal error - Login page', | ||
'<p>We got an internal error when we visit the login page (url: /auth/login)</p>', 'created', 'highest', 5, 4, | ||
NULL, '2022-09-11 20:58:37', '2022-09-12 13:08:12', 4, 'bug'); | ||
NULL, '2022-09-11 20:58:37', '2022-09-12 13:08:12', 4, 'bug', '0001'); | ||
|
||
INSERT INTO `comments` (`id`, `owner_id`, `ticket_id`, `content`, `deleted_at`, `created_at`, `updated_at`) | ||
VALUES (1, 4, 2, '<p>Hello,</p><p>We are working on it, I let you know ASAP.</p><p>Best regards.</p>', NULL, | ||
|
31 changes: 31 additions & 0 deletions
31
database/migrations/2022_09_19_143232_add_ticket_prefix_to_projects.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration { | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('projects', function (Blueprint $table) { | ||
$table->string('ticket_prefix', 4); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('projects', function (Blueprint $table) { | ||
$table->dropColumn('ticket_prefix'); | ||
}); | ||
} | ||
}; |
31 changes: 31 additions & 0 deletions
31
database/migrations/2022_09_19_144042_add_number_to_tickets.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration { | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('tickets', function (Blueprint $table) { | ||
$table->string('number'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('tickets', function (Blueprint $table) { | ||
$table->dropColumn('number'); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.