Apply laravel code style
parent
3de473c795
commit
0c344a92ef
|
|
@ -14,5 +14,6 @@ use BenSampo\Enum\Enum;
|
||||||
final class ContractType extends Enum
|
final class ContractType extends Enum
|
||||||
{
|
{
|
||||||
const BuyContract = '0';
|
const BuyContract = '0';
|
||||||
|
|
||||||
const SellContract = '1';
|
const SellContract = '1';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,14 @@ use BenSampo\Enum\Enum;
|
||||||
final class InsuranceType extends Enum
|
final class InsuranceType extends Enum
|
||||||
{
|
{
|
||||||
const Keine = '0';
|
const Keine = '0';
|
||||||
|
|
||||||
const QBase = '1';
|
const QBase = '1';
|
||||||
|
|
||||||
const OneStar = '2';
|
const OneStar = '2';
|
||||||
|
|
||||||
const ThreeStar = '3';
|
const ThreeStar = '3';
|
||||||
|
|
||||||
const FiveStar = '4';
|
const FiveStar = '4';
|
||||||
|
|
||||||
const FiveStarPlus = '5';
|
const FiveStarPlus = '5';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ use BenSampo\Enum\Enum;
|
||||||
final class PaymentType extends Enum
|
final class PaymentType extends Enum
|
||||||
{
|
{
|
||||||
const Transaction = '0';
|
const Transaction = '0';
|
||||||
|
|
||||||
const Cash = '1';
|
const Cash = '1';
|
||||||
|
|
||||||
const Cembra = '2';
|
const Cembra = '2';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,15 @@
|
||||||
|
|
||||||
namespace App\Exports;
|
namespace App\Exports;
|
||||||
|
|
||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
||||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class Export implements FromCollection, WithHeadings, WithStyles
|
class Export implements FromCollection, WithHeadings, WithStyles
|
||||||
{
|
{
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
protected $headings;
|
protected $headings;
|
||||||
|
|
||||||
public function __construct($model, $headings)
|
public function __construct($model, $headings)
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
namespace App\Exports;
|
namespace App\Exports;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use App\Models\Car;
|
use App\Models\Car;
|
||||||
use App\Models\Contract;
|
use App\Models\Contract;
|
||||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
use Carbon\Carbon;
|
||||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
||||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class Report implements FromCollection, WithTitle, WithHeadings, WithStyles, WithColumnFormatting, ShouldAutoSize
|
class Report implements FromCollection, WithTitle, WithHeadings, WithStyles, WithColumnFormatting, ShouldAutoSize
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use App\Models\Car;
|
|
||||||
use Inertia\Inertia;
|
|
||||||
use App\Models\Brand;
|
|
||||||
use App\Exports\Export;
|
use App\Exports\Export;
|
||||||
|
use App\Models\Brand;
|
||||||
|
use App\Models\Car;
|
||||||
use App\Models\Contract;
|
use App\Models\Contract;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
class CarController extends Controller
|
class CarController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -27,7 +27,6 @@ class CarController extends Controller
|
||||||
|
|
||||||
public function sold(Request $request)
|
public function sold(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->renderCarsList($request, Car::soldOnly(), 'Cars/Sold', 'sell_contract.date');
|
return $this->renderCarsList($request, Car::soldOnly(), 'Cars/Sold', 'sell_contract.date');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,6 +59,7 @@ class CarController extends Controller
|
||||||
->map(function ($car) {
|
->map(function ($car) {
|
||||||
$bcontract = $car->latestBuyContract();
|
$bcontract = $car->latestBuyContract();
|
||||||
$scontract = $car->latestSellContract();
|
$scontract = $car->latestSellContract();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'brand' => $car->brand->name,
|
'brand' => $car->brand->name,
|
||||||
'model' => $car->carModel->name,
|
'model' => $car->carModel->name,
|
||||||
|
|
@ -108,6 +108,7 @@ class CarController extends Controller
|
||||||
->get()
|
->get()
|
||||||
->map(function ($car) {
|
->map(function ($car) {
|
||||||
$contract = $car->latestBuyContract();
|
$contract = $car->latestBuyContract();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'brand' => $car->brand->name,
|
'brand' => $car->brand->name,
|
||||||
'model' => $car->carModel->name,
|
'model' => $car->carModel->name,
|
||||||
|
|
@ -157,6 +158,7 @@ class CarController extends Controller
|
||||||
->map(function ($car) {
|
->map(function ($car) {
|
||||||
$bcontract = $car->latestBuyContract();
|
$bcontract = $car->latestBuyContract();
|
||||||
$scontract = $car->latestSellContract();
|
$scontract = $car->latestSellContract();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'brand' => $car->brand->name,
|
'brand' => $car->brand->name,
|
||||||
'model' => $car->carModel->name,
|
'model' => $car->carModel->name,
|
||||||
|
|
@ -180,7 +182,8 @@ class CarController extends Controller
|
||||||
return Excel::download(new Export($cars, $headings), date('Y-m-d').'-Verkaufte-Autos.xlsx');
|
return Excel::download(new Export($cars, $headings), date('Y-m-d').'-Verkaufte-Autos.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderCarsList(Request $request, $cars, string $renderPage, string $defaultSort = 'buy_contract.date') {
|
private function renderCarsList(Request $request, $cars, string $renderPage, string $defaultSort = 'buy_contract.date')
|
||||||
|
{
|
||||||
$direction = $this->getDirection($request, 'desc');
|
$direction = $this->getDirection($request, 'desc');
|
||||||
$sortBy = $this->getSortBy($request, $defaultSort);
|
$sortBy = $this->getSortBy($request, $defaultSort);
|
||||||
$cars = $this->getWithCustomSort($cars, $sortBy, $direction);
|
$cars = $this->getWithCustomSort($cars, $sortBy, $direction);
|
||||||
|
|
@ -208,11 +211,13 @@ class CarController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getContractFields(?Contract $contract) {
|
private function getContractFields(?Contract $contract)
|
||||||
|
{
|
||||||
if (! $contract) {
|
if (! $contract) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$contact = $contract->contact;
|
$contact = $contract->contact;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $contract->id,
|
'id' => $contract->id,
|
||||||
'date' => $contract->date_formatted,
|
'date' => $contract->date_formatted,
|
||||||
|
|
@ -254,7 +259,8 @@ class CarController extends Controller
|
||||||
->leftJoin('contracts', function ($join) {
|
->leftJoin('contracts', function ($join) {
|
||||||
$join->on('contracts.car_id', '=', 'cars.id')
|
$join->on('contracts.car_id', '=', 'cars.id')
|
||||||
->on('contracts.id', '=', DB::raw("(SELECT id from contracts WHERE contracts.car_id = cars.id and type = '1' order by date desc limit 1)"));
|
->on('contracts.id', '=', DB::raw("(SELECT id from contracts WHERE contracts.car_id = cars.id and type = '1' order by date desc limit 1)"));
|
||||||
})
|
}
|
||||||
|
)
|
||||||
->orderBy('contracts.price', $direction),
|
->orderBy('contracts.price', $direction),
|
||||||
default => $cars->orderBy('initial_date', $direction),
|
default => $cars->orderBy('initial_date', $direction),
|
||||||
};
|
};
|
||||||
|
|
@ -298,6 +304,7 @@ class CarController extends Controller
|
||||||
$car = $this->createCar($request);
|
$car = $this->createCar($request);
|
||||||
|
|
||||||
session()->flash('flash.banner', 'Auto erstellt.');
|
session()->flash('flash.banner', 'Auto erstellt.');
|
||||||
|
|
||||||
return Redirect::route('cars.show', $car);
|
return Redirect::route('cars.show', $car);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -384,12 +391,16 @@ class CarController extends Controller
|
||||||
->orderBy('date', 'desc')
|
->orderBy('date', 'desc')
|
||||||
->with('contact')
|
->with('contact')
|
||||||
->get()
|
->get()
|
||||||
->map(function ($contract) { return $this->getContractFields($contract); }),
|
->map(function ($contract) {
|
||||||
|
return $this->getContractFields($contract);
|
||||||
|
}),
|
||||||
'sell_contracts' => $car->sellContracts()
|
'sell_contracts' => $car->sellContracts()
|
||||||
->orderBy('date', 'desc')
|
->orderBy('date', 'desc')
|
||||||
->with('contact')
|
->with('contact')
|
||||||
->get()
|
->get()
|
||||||
->map(function ($contract) { return $this->getContractFields($contract); }),
|
->map(function ($contract) {
|
||||||
|
return $this->getContractFields($contract);
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
@ -432,6 +443,7 @@ class CarController extends Controller
|
||||||
{
|
{
|
||||||
$this->updateCar($request, $car);
|
$this->updateCar($request, $car);
|
||||||
session()->flash('flash.banner', 'Auto geändert.');
|
session()->flash('flash.banner', 'Auto geändert.');
|
||||||
|
|
||||||
return Redirect::route('cars.show', $car);
|
return Redirect::route('cars.show', $car);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -468,6 +480,7 @@ class CarController extends Controller
|
||||||
{
|
{
|
||||||
$car->delete();
|
$car->delete();
|
||||||
session()->flash('flash.banner', 'Auto gelöscht.');
|
session()->flash('flash.banner', 'Auto gelöscht.');
|
||||||
|
|
||||||
return Redirect::route('cars.show', $car);
|
return Redirect::route('cars.show', $car);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -475,6 +488,7 @@ class CarController extends Controller
|
||||||
{
|
{
|
||||||
$car->restore();
|
$car->restore();
|
||||||
session()->flash('flash.banner', 'Auto wiederhergestellt.');
|
session()->flash('flash.banner', 'Auto wiederhergestellt.');
|
||||||
|
|
||||||
return Redirect::route('cars.show', $car);
|
return Redirect::route('cars.show', $car);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Inertia\Inertia;
|
|
||||||
use App\Exports\Export;
|
use App\Exports\Export;
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use App\Models\Contract;
|
use App\Models\Contract;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
class ContactController extends Controller
|
class ContactController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -27,7 +27,8 @@ class ContactController extends Controller
|
||||||
return $this->renderContactsList($request, Contact::has('sellContracts'), 'Contacts/Buyers');
|
return $this->renderContactsList($request, Contact::has('sellContracts'), 'Contacts/Buyers');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderContactsList(Request $request, $contacts, string $renderPage) {
|
private function renderContactsList(Request $request, $contacts, string $renderPage)
|
||||||
|
{
|
||||||
$direction = $this->getDirection($request);
|
$direction = $this->getDirection($request);
|
||||||
$sortBy = $this->getSortBy($request);
|
$sortBy = $this->getSortBy($request);
|
||||||
$contacts = $this->getWithCustomSort($contacts, $sortBy, $direction);
|
$contacts = $this->getWithCustomSort($contacts, $sortBy, $direction);
|
||||||
|
|
@ -58,7 +59,7 @@ class ContactController extends Controller
|
||||||
public function letter(Contact $contact)
|
public function letter(Contact $contact)
|
||||||
{
|
{
|
||||||
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor(resource_path().'/docx/letter.docx');
|
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor(resource_path().'/docx/letter.docx');
|
||||||
$templateProcessor->setValue('date', date("d.m.Y"));
|
$templateProcessor->setValue('date', date('d.m.Y'));
|
||||||
$templateProcessor->setValue('company', $contact->company);
|
$templateProcessor->setValue('company', $contact->company);
|
||||||
$templateProcessor->setValue('name', $contact->name);
|
$templateProcessor->setValue('name', $contact->name);
|
||||||
$templateProcessor->setValue('address', $contact->address);
|
$templateProcessor->setValue('address', $contact->address);
|
||||||
|
|
@ -66,7 +67,7 @@ class ContactController extends Controller
|
||||||
$templateProcessor->setValue('country', $contact->country !== 'CH' ? $contact->country : '');
|
$templateProcessor->setValue('country', $contact->country !== 'CH' ? $contact->country : '');
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$templateProcessor->saveAs("php://output");
|
$templateProcessor->saveAs('php://output');
|
||||||
$contents = ob_get_contents();
|
$contents = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
|
@ -160,6 +161,7 @@ class ContactController extends Controller
|
||||||
);
|
);
|
||||||
|
|
||||||
session()->flash('flash.banner', 'Kontakt erstellt.');
|
session()->flash('flash.banner', 'Kontakt erstellt.');
|
||||||
|
|
||||||
return Redirect::route('contacts.show', $contact);
|
return Redirect::route('contacts.show', $contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,7 +204,7 @@ class ContactController extends Controller
|
||||||
'city' => $contact->city,
|
'city' => $contact->city,
|
||||||
'country' => $contact->country,
|
'country' => $contact->country,
|
||||||
'deleted_at' => $contact->deleted_at,
|
'deleted_at' => $contact->deleted_at,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,21 +241,27 @@ class ContactController extends Controller
|
||||||
->orderBy('date', 'desc')
|
->orderBy('date', 'desc')
|
||||||
->with('car')
|
->with('car')
|
||||||
->get()
|
->get()
|
||||||
->map(function ($contract) { return $this->getContractFields($contract); }),
|
->map(function ($contract) {
|
||||||
|
return $this->getContractFields($contract);
|
||||||
|
}),
|
||||||
'sell_contracts' => $contact->sellContracts()
|
'sell_contracts' => $contact->sellContracts()
|
||||||
->orderBy('date', 'desc')
|
->orderBy('date', 'desc')
|
||||||
->with('car')
|
->with('car')
|
||||||
->get()
|
->get()
|
||||||
->map(function ($contract) { return $this->getContractFields($contract); }),
|
->map(function ($contract) {
|
||||||
]
|
return $this->getContractFields($contract);
|
||||||
|
}),
|
||||||
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getContractFields(?Contract $contract) {
|
private function getContractFields(?Contract $contract)
|
||||||
|
{
|
||||||
if (! $contract) {
|
if (! $contract) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$car = $contract->car;
|
$car = $contract->car;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $contract->id,
|
'id' => $contract->id,
|
||||||
'date' => $contract->date_formatted,
|
'date' => $contract->date_formatted,
|
||||||
|
|
@ -270,6 +278,7 @@ class ContactController extends Controller
|
||||||
);
|
);
|
||||||
|
|
||||||
session()->flash('flash.banner', 'Kontakt geändert.');
|
session()->flash('flash.banner', 'Kontakt geändert.');
|
||||||
|
|
||||||
return Redirect::route('contacts.show', $contact);
|
return Redirect::route('contacts.show', $contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,6 +302,7 @@ class ContactController extends Controller
|
||||||
{
|
{
|
||||||
$contact->delete();
|
$contact->delete();
|
||||||
session()->flash('flash.banner', 'Kontakt gelöscht.');
|
session()->flash('flash.banner', 'Kontakt gelöscht.');
|
||||||
|
|
||||||
return Redirect::back();
|
return Redirect::back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -300,6 +310,7 @@ class ContactController extends Controller
|
||||||
{
|
{
|
||||||
$contact->restore();
|
$contact->restore();
|
||||||
session()->flash('flash.banner', 'Kontakt wiederhergestellt.');
|
session()->flash('flash.banner', 'Kontakt wiederhergestellt.');
|
||||||
|
|
||||||
return Redirect::back();
|
return Redirect::back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,24 +2,23 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use App\Models\Car;
|
|
||||||
use Inertia\Inertia;
|
|
||||||
use App\Models\Brand;
|
|
||||||
use App\Models\Contact;
|
|
||||||
use App\Models\Payment;
|
|
||||||
use App\Models\Contract;
|
|
||||||
use App\Enums\PaymentType;
|
|
||||||
use App\Enums\ContractType;
|
use App\Enums\ContractType;
|
||||||
use App\Enums\InsuranceType;
|
use App\Enums\InsuranceType;
|
||||||
use Illuminate\Http\Request;
|
use App\Enums\PaymentType;
|
||||||
use Illuminate\Validation\Rule;
|
use App\Models\Brand;
|
||||||
|
use App\Models\Car;
|
||||||
|
use App\Models\Contact;
|
||||||
|
use App\Models\Contract;
|
||||||
|
use App\Models\Payment;
|
||||||
use Barryvdh\DomPDF\Facade as PDF;
|
use Barryvdh\DomPDF\Facade as PDF;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
|
||||||
class ContractController extends Controller
|
class ContractController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function dashboard()
|
public function dashboard()
|
||||||
{
|
{
|
||||||
return Inertia::render('Dashboard', [
|
return Inertia::render('Dashboard', [
|
||||||
|
|
@ -80,7 +79,8 @@ class ContractController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCarFields(?Car $car) {
|
private function getCarFields(?Car $car)
|
||||||
|
{
|
||||||
if (! $car) {
|
if (! $car) {
|
||||||
return [
|
return [
|
||||||
'name' => null,
|
'name' => null,
|
||||||
|
|
@ -93,6 +93,7 @@ class ContractController extends Controller
|
||||||
'initial_date' => null,
|
'initial_date' => null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => $car->name,
|
'name' => $car->name,
|
||||||
'label' => $car->name.' ('.$car->stammnummer.')',
|
'label' => $car->name.' ('.$car->stammnummer.')',
|
||||||
|
|
@ -105,7 +106,8 @@ class ContractController extends Controller
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getContactFields(?Contact $contact) {
|
private function getContactFields(?Contact $contact)
|
||||||
|
{
|
||||||
if (! $contact) {
|
if (! $contact) {
|
||||||
return [
|
return [
|
||||||
'id' => null,
|
'id' => null,
|
||||||
|
|
@ -122,6 +124,7 @@ class ContractController extends Controller
|
||||||
'email' => null,
|
'email' => null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $contact->id,
|
'id' => $contact->id,
|
||||||
'title' => $contact->full_title,
|
'title' => $contact->full_title,
|
||||||
|
|
@ -181,8 +184,8 @@ class ContractController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
session()->flash('flash.banner', 'Vertrag erstellt.');
|
session()->flash('flash.banner', 'Vertrag erstellt.');
|
||||||
return Redirect::route('contracts.show', $contract);
|
|
||||||
|
|
||||||
|
return Redirect::route('contracts.show', $contract);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(Contract $contract)
|
public function edit(Contract $contract)
|
||||||
|
|
@ -230,8 +233,8 @@ class ContractController extends Controller
|
||||||
$contract->update($request->all());
|
$contract->update($request->all());
|
||||||
|
|
||||||
session()->flash('flash.banner', 'Vertrag geändert.');
|
session()->flash('flash.banner', 'Vertrag geändert.');
|
||||||
return Redirect::route('contracts.show', $contract);
|
|
||||||
|
|
||||||
|
return Redirect::route('contracts.show', $contract);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show(Contract $contract)
|
public function show(Contract $contract)
|
||||||
|
|
@ -283,13 +286,14 @@ class ContractController extends Controller
|
||||||
{
|
{
|
||||||
$contxt = stream_context_create([
|
$contxt = stream_context_create([
|
||||||
'ssl' => [
|
'ssl' => [
|
||||||
'verify_peer' => FALSE,
|
'verify_peer' => false,
|
||||||
'verify_peer_name' => FALSE,
|
'verify_peer_name' => false,
|
||||||
'allow_self_signed'=> TRUE
|
'allow_self_signed'=> true,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
$pdf = PDF::setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true])->loadView('contract', compact('contract'));
|
$pdf = PDF::setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true])->loadView('contract', compact('contract'));
|
||||||
$pdf->getDomPDF()->setHttpContext($contxt);
|
$pdf->getDomPDF()->setHttpContext($contxt);
|
||||||
|
|
||||||
return $pdf->stream($contract->date.'_'.$contract->type_formatted.'.pdf');
|
return $pdf->stream($contract->date.'_'.$contract->type_formatted.'.pdf');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -297,6 +301,7 @@ class ContractController extends Controller
|
||||||
{
|
{
|
||||||
$contract->delete();
|
$contract->delete();
|
||||||
session()->flash('flash.banner', 'Vertrag gelöscht.');
|
session()->flash('flash.banner', 'Vertrag gelöscht.');
|
||||||
|
|
||||||
return Redirect::route('contracts.show', $contract);
|
return Redirect::route('contracts.show', $contract);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -304,6 +309,7 @@ class ContractController extends Controller
|
||||||
{
|
{
|
||||||
$contract->restore();
|
$contract->restore();
|
||||||
session()->flash('flash.banner', 'Vertrag wiederhergestellt.');
|
session()->flash('flash.banner', 'Vertrag wiederhergestellt.');
|
||||||
|
|
||||||
return Redirect::route('contracts.show', $contract);
|
return Redirect::route('contracts.show', $contract);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
class Controller extends BaseController
|
class Controller extends BaseController
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ class DocumentController extends Controller
|
||||||
{
|
{
|
||||||
if (file_exists($document->path)) {
|
if (file_exists($document->path)) {
|
||||||
header('Content-Disposition: filename="'.$document->name.'"');
|
header('Content-Disposition: filename="'.$document->name.'"');
|
||||||
|
|
||||||
return response()->file($document->path);
|
return response()->file($document->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,6 +55,7 @@ class DocumentController extends Controller
|
||||||
|
|
||||||
if (! $document) {
|
if (! $document) {
|
||||||
session()->flash('flash.banner', 'Fehler beim Löschen, Dokument nicht gefunden.');
|
session()->flash('flash.banner', 'Fehler beim Löschen, Dokument nicht gefunden.');
|
||||||
|
|
||||||
return Redirect::back();
|
return Redirect::back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,6 +65,7 @@ class DocumentController extends Controller
|
||||||
|
|
||||||
$document->delete();
|
$document->delete();
|
||||||
session()->flash('flash.banner', 'Dokument gelöscht.');
|
session()->flash('flash.banner', 'Dokument gelöscht.');
|
||||||
|
|
||||||
return Redirect::back();
|
return Redirect::back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Inertia\Inertia;
|
|
||||||
use App\Models\Payment;
|
|
||||||
use App\Models\Contract;
|
|
||||||
use Barryvdh\DomPDF\Facade as PDF;
|
|
||||||
use App\Enums\PaymentType;
|
use App\Enums\PaymentType;
|
||||||
|
use App\Models\Contract;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use Barryvdh\DomPDF\Facade as PDF;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
|
||||||
class PaymentController extends Controller
|
class PaymentController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -39,6 +39,7 @@ class PaymentController extends Controller
|
||||||
$payment = Payment::create($request->all());
|
$payment = Payment::create($request->all());
|
||||||
|
|
||||||
session()->flash('flash.banner', 'Einzahlung gespeichert.');
|
session()->flash('flash.banner', 'Einzahlung gespeichert.');
|
||||||
|
|
||||||
return Redirect::route('contracts.show', $payment->contract);
|
return Redirect::route('contracts.show', $payment->contract);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,13 +47,14 @@ class PaymentController extends Controller
|
||||||
{
|
{
|
||||||
$contxt = stream_context_create([
|
$contxt = stream_context_create([
|
||||||
'ssl' => [
|
'ssl' => [
|
||||||
'verify_peer' => FALSE,
|
'verify_peer' => false,
|
||||||
'verify_peer_name' => FALSE,
|
'verify_peer_name' => false,
|
||||||
'allow_self_signed'=> TRUE
|
'allow_self_signed'=> true,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
$pdf = PDF::setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true])->loadView('receipt', compact('contract', 'payment'));
|
$pdf = PDF::setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true])->loadView('receipt', compact('contract', 'payment'));
|
||||||
$pdf->getDomPDF()->setHttpContext($contxt);
|
$pdf->getDomPDF()->setHttpContext($contxt);
|
||||||
|
|
||||||
return $pdf->stream($payment->date.'_quittung.pdf');
|
return $pdf->stream($payment->date.'_quittung.pdf');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Inertia\Inertia;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Exports\Report;
|
use App\Exports\Report;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Inertia\Inertia;
|
||||||
use Maatwebsite\Excel\Facades\Excel as Excel;
|
use Maatwebsite\Excel\Facades\Excel as Excel;
|
||||||
|
|
||||||
class ReportController extends Controller
|
class ReportController extends Controller
|
||||||
|
|
@ -17,6 +17,7 @@ class ReportController extends Controller
|
||||||
public function print(Request $request)
|
public function print(Request $request)
|
||||||
{
|
{
|
||||||
$year = (int) $request->get('year');
|
$year = (int) $request->get('year');
|
||||||
|
|
||||||
return Excel::download(new Report($year), 'Wagenhandelbuch-'.$year.'.xlsx');
|
return Excel::download(new Report($year), 'Wagenhandelbuch-'.$year.'.xlsx');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use App\Enums\ContractType;
|
use App\Enums\ContractType;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
|
|
||||||
class Car extends Model
|
class Car extends Model
|
||||||
{
|
{
|
||||||
|
|
@ -169,10 +169,8 @@ class Car extends Model
|
||||||
$query->onlyTrashed();
|
$query->onlyTrashed();
|
||||||
}
|
}
|
||||||
})->when($filters['brand'] ?? null, function ($query, $brand) {
|
})->when($filters['brand'] ?? null, function ($query, $brand) {
|
||||||
$query->whereHas('carModel', function($q) use ($brand)
|
$query->whereHas('carModel', function ($q) use ($brand) {
|
||||||
{
|
|
||||||
$q->where('brand_id', '=', $brand);
|
$q->where('brand_id', '=', $brand);
|
||||||
|
|
||||||
})->get();
|
})->get();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use App\Enums\ContractType;
|
use App\Enums\ContractType;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
|
|
||||||
class Contact extends Model
|
class Contact extends Model
|
||||||
{
|
{
|
||||||
|
|
@ -63,7 +63,6 @@ class Contact extends Model
|
||||||
return implode(', ', array_filter([$this->company, $this->name]));
|
return implode(', ', array_filter([$this->company, $this->name]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getFullTitleWithAddressAttribute()
|
public function getFullTitleWithAddressAttribute()
|
||||||
{
|
{
|
||||||
return implode(', ', array_filter([$this->full_title, $this->address, $this->full_city]));
|
return implode(', ', array_filter([$this->full_title, $this->address, $this->full_city]));
|
||||||
|
|
@ -115,7 +114,6 @@ class Contact extends Model
|
||||||
->orWhere('phone', 'like', '%'.$part.'%');
|
->orWhere('phone', 'like', '%'.$part.'%');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
})->when($filters['trashed'] ?? null, function ($query, $trashed) {
|
})->when($filters['trashed'] ?? null, function ($query, $trashed) {
|
||||||
if ($trashed === 'with') {
|
if ($trashed === 'with') {
|
||||||
$query->withTrashed();
|
$query->withTrashed();
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Cknow\Money\Money;
|
|
||||||
use App\Enums\ContractType;
|
use App\Enums\ContractType;
|
||||||
use App\Enums\InsuranceType;
|
use App\Enums\InsuranceType;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Cknow\Money\Money;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
|
|
||||||
class Contract extends Model
|
class Contract extends Model
|
||||||
{
|
{
|
||||||
|
|
@ -47,31 +47,26 @@ class Contract extends Model
|
||||||
|
|
||||||
public function getPaidAttribute()
|
public function getPaidAttribute()
|
||||||
{
|
{
|
||||||
|
|
||||||
return Money::CHF($this->payments()->sum('amount'));
|
return Money::CHF($this->payments()->sum('amount'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPaidInCashAttribute()
|
public function getPaidInCashAttribute()
|
||||||
{
|
{
|
||||||
|
|
||||||
return Money::CHF($this->payments()->cashOnly()->sum('amount'));
|
return Money::CHF($this->payments()->cashOnly()->sum('amount'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPaidInTransactionAttribute()
|
public function getPaidInTransactionAttribute()
|
||||||
{
|
{
|
||||||
|
|
||||||
return Money::CHF($this->payments()->transactionOnly()->sum('amount'));
|
return Money::CHF($this->payments()->transactionOnly()->sum('amount'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPaidInCembraAttribute()
|
public function getPaidInCembraAttribute()
|
||||||
{
|
{
|
||||||
|
|
||||||
return Money::CHF($this->payments()->cembraOnly()->sum('amount'));
|
return Money::CHF($this->payments()->cembraOnly()->sum('amount'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLeftToPayAttribute()
|
public function getLeftToPayAttribute()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->price->subtract($this->paid);
|
return $this->price->subtract($this->paid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Document extends Model
|
class Document extends Model
|
||||||
{
|
{
|
||||||
|
|
@ -37,14 +37,14 @@ class Document extends Model
|
||||||
public function getSizeAttribute($size)
|
public function getSizeAttribute($size)
|
||||||
{
|
{
|
||||||
if ($size / 1024 < 1) {
|
if ($size / 1024 < 1) {
|
||||||
return $size . " B";
|
return $size.' B';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($size / 1024 / 1024 < 1) {
|
if ($size / 1024 / 1024 < 1) {
|
||||||
return floor($size / 1024) . " KB";
|
return floor($size / 1024).' KB';
|
||||||
}
|
}
|
||||||
|
|
||||||
return floor($size / 1024 / 1024) . " MB";
|
return floor($size / 1024 / 1024).' MB';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLinkAttribute()
|
public function getLinkAttribute()
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Enums\PaymentType;
|
||||||
|
use App\Models\Contract;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Cknow\Money\Money;
|
use Cknow\Money\Money;
|
||||||
use App\Models\Contract;
|
|
||||||
use App\Enums\PaymentType;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Payment extends Model
|
class Payment extends Model
|
||||||
{
|
{
|
||||||
|
|
@ -42,12 +42,11 @@ class Payment extends Model
|
||||||
|
|
||||||
public function getTypeAttribute($type)
|
public function getTypeAttribute($type)
|
||||||
{
|
{
|
||||||
|
|
||||||
return match ($type) {
|
return match ($type) {
|
||||||
PaymentType::Transaction() => 'Banküberweisung',
|
PaymentType::Transaction() => 'Banküberweisung',
|
||||||
PaymentType::Cash() => 'Barzahlung',
|
PaymentType::Cash() => 'Barzahlung',
|
||||||
default => 'Überweisung via Cembra',
|
default => 'Überweisung via Cembra',
|
||||||
};;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTypeTextAttribute()
|
public function getTypeTextAttribute()
|
||||||
|
|
@ -56,7 +55,7 @@ class Payment extends Model
|
||||||
'Banküberweisung' => 'via Banküberweisung erhalten',
|
'Banküberweisung' => 'via Banküberweisung erhalten',
|
||||||
'Barzahlung' => 'in bar erhalten',
|
'Barzahlung' => 'in bar erhalten',
|
||||||
default => 'via Cembra-Überweisung erhalten',
|
default => 'via Cembra-Überweisung erhalten',
|
||||||
};;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPrintLinkAttribute()
|
public function getPrintLinkAttribute()
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class MorphServiceProvider extends ServiceProvider
|
class MorphServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ namespace App\Providers;
|
||||||
|
|
||||||
use App\Models\Car;
|
use App\Models\Car;
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use App\Models\Payment;
|
|
||||||
use App\Models\Contract;
|
use App\Models\Contract;
|
||||||
use Illuminate\Http\Request;
|
use App\Models\Payment;
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
use Illuminate\Cache\RateLimiting\Limit;
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
use Illuminate\Support\Facades\RateLimiter;
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
@ -46,6 +46,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||||
if (in_array(Route::currentRouteName(), ['cars.show', 'cars.restore'])) {
|
if (in_array(Route::currentRouteName(), ['cars.show', 'cars.restore'])) {
|
||||||
return Car::withTrashed()->find($value);
|
return Car::withTrashed()->find($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Car::find($value);
|
return Car::find($value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -53,6 +54,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||||
if (in_array(Route::currentRouteName(), ['contacts.show', 'contacts.restore'])) {
|
if (in_array(Route::currentRouteName(), ['contacts.show', 'contacts.restore'])) {
|
||||||
return Contact::withTrashed()->find($value);
|
return Contact::withTrashed()->find($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Contact::find($value);
|
return Contact::find($value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -60,6 +62,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||||
if (in_array(Route::currentRouteName(), ['contracts.show', 'contracts.restore', 'payments.destroy', 'payments.print'])) {
|
if (in_array(Route::currentRouteName(), ['contracts.show', 'contracts.restore', 'payments.destroy', 'payments.print'])) {
|
||||||
return Contract::withTrashed()->find($value);
|
return Contract::withTrashed()->find($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Contract::find($value);
|
return Contract::find($value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,6 @@ return [
|
||||||
'custom' => [
|
'custom' => [
|
||||||
// 'MY1' => 2,
|
// 'MY1' => 2,
|
||||||
// 'MY2' => 3
|
// 'MY2' => 3
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\Brand;
|
||||||
use App\Models\CarModel;
|
use App\Models\CarModel;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use App\Models\Brand;
|
|
||||||
|
|
||||||
class CarModelFactory extends Factory
|
class CarModelFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
||||||
use Faker\Provider\de_CH\PhoneNumber;
|
use Faker\Provider\de_CH\PhoneNumber;
|
||||||
use Faker\Provider\en_US\Person;
|
|
||||||
use Faker\Provider\en_US\Address;
|
use Faker\Provider\en_US\Address;
|
||||||
use Faker\Provider\en_US\Company;
|
use Faker\Provider\en_US\Company;
|
||||||
|
use Faker\Provider\en_US\Person;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class ContactFactory extends Factory
|
class ContactFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\Contract;
|
use App\Enums\ContractType;
|
||||||
|
use App\Enums\InsuranceType;
|
||||||
use App\Models\Car;
|
use App\Models\Car;
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
|
use App\Models\Contract;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use App\Enums\InsuranceType;
|
|
||||||
use App\Enums\ContractType;
|
|
||||||
|
|
||||||
class ContractFactory extends Factory
|
class ContractFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,10 @@
|
||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\Document;
|
|
||||||
use App\Models\Contract;
|
use App\Models\Contract;
|
||||||
|
use App\Models\Document;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
|
||||||
class DocumentFactory extends Factory
|
class DocumentFactory extends Factory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\Payment;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
||||||
use App\Enums\PaymentType;
|
use App\Enums\PaymentType;
|
||||||
use App\Models\Contract;
|
use App\Models\Contract;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class PaymentFactory extends Factory
|
class PaymentFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Enums\ContractType;
|
||||||
|
use App\Enums\InsuranceType;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use App\Enums\InsuranceType;
|
|
||||||
use App\Enums\ContractType;
|
|
||||||
|
|
||||||
class CreateContractsTable extends Migration
|
class CreateContractsTable extends Migration
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Enums\PaymentType;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use App\Enums\PaymentType;
|
|
||||||
|
|
||||||
class CreatePaymentsTable extends Migration
|
class CreatePaymentsTable extends Migration
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
use App\Models\Brand;
|
||||||
use App\Models\User;
|
|
||||||
use App\Models\Team;
|
|
||||||
use App\Models\Car;
|
use App\Models\Car;
|
||||||
use App\Models\CarModel;
|
use App\Models\CarModel;
|
||||||
use App\Models\Brand;
|
|
||||||
use App\Models\Payment;
|
|
||||||
use App\Models\Contract;
|
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
|
use App\Models\Contract;
|
||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use App\Models\Team;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
|
|
@ -1173,5 +1173,4 @@ class DatabaseSeeder extends Seeder
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\ContactController;
|
|
||||||
use App\Http\Controllers\CarController;
|
|
||||||
use App\Http\Controllers\BrandController;
|
use App\Http\Controllers\BrandController;
|
||||||
use App\Http\Controllers\ReportController;
|
use App\Http\Controllers\CarController;
|
||||||
use App\Http\Controllers\CarModelController;
|
use App\Http\Controllers\CarModelController;
|
||||||
use App\Http\Controllers\PaymentController;
|
use App\Http\Controllers\ContactController;
|
||||||
use App\Http\Controllers\ContractController;
|
use App\Http\Controllers\ContractController;
|
||||||
use App\Http\Controllers\DocumentController;
|
use App\Http\Controllers\DocumentController;
|
||||||
|
use App\Http\Controllers\PaymentController;
|
||||||
|
use App\Http\Controllers\ReportController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::middleware(['auth:sanctum', 'verified'])->group(function () {
|
Route::middleware(['auth:sanctum', 'verified'])->group(function () {
|
||||||
Route::get('/', [ContractController::class, 'dashboard'])->name('dashboard');
|
Route::get('/', [ContractController::class, 'dashboard'])->name('dashboard');
|
||||||
|
|
||||||
|
|
@ -74,7 +75,6 @@ Route::middleware(['auth:sanctum', 'verified'])->group(function () {
|
||||||
Route::post('/', [PaymentController::class, 'store'])->name('payments.store');
|
Route::post('/', [PaymentController::class, 'store'])->name('payments.store');
|
||||||
Route::get('{payment}/print', [PaymentController::class, 'print'])->name('payments.print');
|
Route::get('{payment}/print', [PaymentController::class, 'print'])->name('payments.print');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue