mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +00:00
* Convert string references to `::class` PHP 5.5.9 adds the new static `class` property which provides the fully qualified class name. This is preferred over using strings for class names since the `class` property references are checked by PHP. * Use Faker methods Accessing Faker properties was deprecated in Faker 1.14. * Convert route options to fluent methods Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods. * Adopt class based routes * Remove default `app` files * Shift core files * Streamline config files * Set new `ENV` variables * Default new `bootstrap/app.php` * Re-register HTTP middleware * Consolidate service providers * Re-register service providers * Re-register routes * Re-register scheduled commands * Bump Composer dependencies * Use `<env>` tags for configuration `<env>` tags have a lower precedence than system environment variables making it easier to overwrite PHPUnit configuration values in additional environments, such a CI. Review this blog post for more details on configuration precedence when testing Laravel: https://jasonmccreary.me/articles/laravel-testing-configuration-precedence/ * Adopt anonymous migrations * Rename `password_resets` table * Convert `$casts` property to method * Adopt Laravel type hints * Mark base controller as `abstract` * Remove `CreatesApplication` testing trait * Shift cleanup * Fix shift first issues * Updating Rules for laravel 11, sanctum config and pint * Fix Carbon issue on dashboard * Temporary fix for tests while migration is issue fixed on laravel side * Carbon needs numerical values, not strings * Minimum php version * Fix domain installation step not fetching the correct company_id * Fix Role Policy wasn't properly registered ---------
148 lines
5.9 KiB
PHP
148 lines
5.9 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\V1\Admin\Auth\LoginController;
|
|
use App\Http\Controllers\V1\Admin\Expense\ShowReceiptController;
|
|
use App\Http\Controllers\V1\Admin\Report\CustomerSalesReportController;
|
|
use App\Http\Controllers\V1\Admin\Report\ExpensesReportController;
|
|
use App\Http\Controllers\V1\Admin\Report\ItemSalesReportController;
|
|
use App\Http\Controllers\V1\Admin\Report\ProfitLossReportController;
|
|
use App\Http\Controllers\V1\Admin\Report\TaxSummaryReportController;
|
|
use App\Http\Controllers\V1\Customer\Auth\LoginController as CustomerLoginController;
|
|
use App\Http\Controllers\V1\Customer\EstimatePdfController as CustomerEstimatePdfController;
|
|
use App\Http\Controllers\V1\Customer\InvoicePdfController as CustomerInvoicePdfController;
|
|
use App\Http\Controllers\V1\Customer\PaymentPdfController as CustomerPaymentPdfController;
|
|
use App\Http\Controllers\V1\Modules\ScriptController;
|
|
use App\Http\Controllers\V1\Modules\StyleController;
|
|
use App\Http\Controllers\V1\PDF\DownloadReceiptController;
|
|
use App\Http\Controllers\V1\PDF\EstimatePdfController;
|
|
use App\Http\Controllers\V1\PDF\InvoicePdfController;
|
|
use App\Http\Controllers\V1\PDF\PaymentPdfController;
|
|
use App\Models\Company;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
// Module Asset Includes
|
|
// ----------------------------------------------
|
|
|
|
Route::get('/modules/styles/{style}', StyleController::class);
|
|
|
|
Route::get('/modules/scripts/{script}', ScriptController::class);
|
|
|
|
// Admin Auth
|
|
// ----------------------------------------------
|
|
|
|
Route::post('login', [LoginController::class, 'login']);
|
|
|
|
Route::post('auth/logout', function () {
|
|
Auth::guard('web')->logout();
|
|
});
|
|
|
|
// Customer auth
|
|
// ----------------------------------------------
|
|
|
|
Route::post('/{company:slug}/customer/login', CustomerLoginController::class);
|
|
|
|
Route::post('/{company:slug}/customer/logout', function () {
|
|
Auth::guard('customer')->logout();
|
|
});
|
|
|
|
// Report PDF & Expense Endpoints
|
|
// ----------------------------------------------
|
|
|
|
Route::middleware('auth:sanctum')->prefix('reports')->group(function () {
|
|
|
|
// sales report by customer
|
|
//----------------------------------
|
|
Route::get('/sales/customers/{hash}', CustomerSalesReportController::class);
|
|
|
|
// sales report by items
|
|
//----------------------------------
|
|
Route::get('/sales/items/{hash}', ItemSalesReportController::class);
|
|
|
|
// report for expenses
|
|
//----------------------------------
|
|
Route::get('/expenses/{hash}', ExpensesReportController::class);
|
|
|
|
// report for tax summary
|
|
//----------------------------------
|
|
Route::get('/tax-summary/{hash}', TaxSummaryReportController::class);
|
|
|
|
// report for profit and loss
|
|
//----------------------------------
|
|
Route::get('/profit-loss/{hash}', ProfitLossReportController::class);
|
|
|
|
// download expense receipt
|
|
// -------------------------------------------------
|
|
Route::get('/expenses/{expense}/download-receipt', DownloadReceiptController::class);
|
|
Route::get('/expenses/{expense}/receipt', ShowReceiptController::class);
|
|
});
|
|
|
|
// PDF Endpoints
|
|
// ----------------------------------------------
|
|
|
|
Route::middleware('pdf-auth')->group(function () {
|
|
|
|
// invoice pdf
|
|
// -------------------------------------------------
|
|
Route::get('/invoices/pdf/{invoice:unique_hash}', InvoicePdfController::class);
|
|
|
|
// estimate pdf
|
|
// -------------------------------------------------
|
|
Route::get('/estimates/pdf/{estimate:unique_hash}', EstimatePdfController::class);
|
|
|
|
// payment pdf
|
|
// -------------------------------------------------
|
|
Route::get('/payments/pdf/{payment:unique_hash}', PaymentPdfController::class);
|
|
});
|
|
|
|
// customer pdf endpoints for invoice, estimate and Payment
|
|
// -------------------------------------------------
|
|
|
|
Route::prefix('/customer')->group(function () {
|
|
Route::get('/invoices/{email_log:token}', [CustomerInvoicePdfController::class, 'getInvoice']);
|
|
Route::get('/invoices/view/{email_log:token}', [CustomerInvoicePdfController::class, 'getPdf'])->name('invoice');
|
|
|
|
Route::get('/estimates/{email_log:token}', [CustomerEstimatePdfController::class, 'getEstimate']);
|
|
Route::get('/estimates/view/{email_log:token}', [CustomerEstimatePdfController::class, 'getPdf'])->name('estimate');
|
|
|
|
Route::get('/payments/{email_log:token}', [CustomerPaymentPdfController::class, 'getPayment']);
|
|
Route::get('/payments/view/{email_log:token}', [CustomerPaymentPdfController::class, 'getPdf'])->name('payment');
|
|
});
|
|
|
|
// Setup for installation of app
|
|
// ----------------------------------------------
|
|
|
|
Route::get('/installation', function () {
|
|
return view('app');
|
|
})->name('install')->middleware('redirect-if-installed');
|
|
|
|
// Move other http requests to the Vue App
|
|
// -------------------------------------------------
|
|
|
|
Route::get('/admin/{vue?}', function () {
|
|
return view('app');
|
|
})->where('vue', '[\/\w\.-]*')->name('admin.dashboard')->middleware(['install', 'redirect-if-unauthenticated']);
|
|
|
|
Route::get('{company:slug}/customer/{vue?}', function (Company $company) {
|
|
return view('app')->with([
|
|
'customer_logo' => get_company_setting('customer_portal_logo', $company->id),
|
|
'current_theme' => get_company_setting('customer_portal_theme', $company->id),
|
|
'customer_page_title' => get_company_setting('customer_portal_page_title', $company->id),
|
|
]);
|
|
})->where('vue', '[\/\w\.-]*')->name('customer.dashboard')->middleware(['install']);
|
|
|
|
Route::get('/', function () {
|
|
return view('app');
|
|
})->where('vue', '[\/\w\.-]*')->name('home')->middleware(['install', 'guest']);
|
|
|
|
Route::get('/reset-password/{token}', function () {
|
|
return view('app');
|
|
})->where('vue', '[\/\w\.-]*')->name('reset-password')->middleware(['install', 'guest']);
|
|
|
|
Route::get('/forgot-password', function () {
|
|
return view('app');
|
|
})->where('vue', '[\/\w\.-]*')->name('forgot-password')->middleware(['install', 'guest']);
|
|
|
|
Route::get('/login', function () {
|
|
return view('app');
|
|
})->where('vue', '[\/\w\.-]*')->name('login')->middleware(['install', 'guest']);
|