Fixed transfer category delete and changed type issue..
This commit is contained in:
@ -31,6 +31,13 @@ class DeleteCategory extends Job implements ShouldDelete
|
||||
*/
|
||||
public function authorize(): void
|
||||
{
|
||||
// Can not delete transfer category
|
||||
if ($this->model->isTransferCategory()) {
|
||||
$message = trans('messages.error.transfer_category', ['type' => $this->model->name]);
|
||||
|
||||
throw new \Exception($message);
|
||||
}
|
||||
|
||||
// Can not delete the last category by type
|
||||
if (Category::where('type', $this->model->type)->count() == 1) {
|
||||
$message = trans('messages.error.last_category', ['type' => strtolower(trans_choice('general.' . $this->model->type . 's', 1))]);
|
||||
|
Reference in New Issue
Block a user