Build a tax dropdown for further usage.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\View\Composers\TaxDropdown;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Translation\Translator;
|
||||
|
||||
@@ -29,6 +30,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
\Illuminate\Support\Facades\View::composer('components.tax-dropdown', TaxDropdown::class);
|
||||
}
|
||||
}
|
||||
|
||||
16
app/View/Composers/TaxDropdown.php
Normal file
16
app/View/Composers/TaxDropdown.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Composers;
|
||||
|
||||
use App\Models\Taxrate;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class TaxDropdown
|
||||
{
|
||||
public function compose(View $view): void
|
||||
{
|
||||
$standard = Taxrate::where('active', true)->first();
|
||||
|
||||
$view->with(['tax_rates' => TaxRate::all(), 'standard' => $standard->rate]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user