|
|
@@ -77,35 +77,19 @@ $controller = new class($document_type, $document_number) {
|
|
|
}
|
|
|
|
|
|
private function requireCompany(int $id): Company {
|
|
|
- $company = Company::get($id);
|
|
|
- if(!$company) {
|
|
|
- throw new RuntimeException(__("Company not found."));
|
|
|
- }
|
|
|
- return $company;
|
|
|
+ return Company::require($id);
|
|
|
}
|
|
|
|
|
|
private function requireLocation(int $id): Location {
|
|
|
- $location = Location::get($id);
|
|
|
- if(!$location) {
|
|
|
- throw new RuntimeException(__("Location not found."));
|
|
|
- }
|
|
|
- return $location;
|
|
|
+ return Location::require($id);
|
|
|
}
|
|
|
|
|
|
private function requireTicket(int $id): Ticket {
|
|
|
- $ticket = Ticket::get($id);
|
|
|
- if(!$ticket) {
|
|
|
- throw new RuntimeException(__("Ticket not found."));
|
|
|
- }
|
|
|
- return $ticket;
|
|
|
+ return Ticket::require($id);
|
|
|
}
|
|
|
|
|
|
private function requireSupplier(int $id): Supplier {
|
|
|
- $supplier = Supplier::get($id);
|
|
|
- if(!$supplier) {
|
|
|
- throw new RuntimeException(__("Supplier not found."));
|
|
|
- }
|
|
|
- return $supplier;
|
|
|
+ return Supplier::require($id);
|
|
|
}
|
|
|
|
|
|
public function view(): void {
|