Skip to content

Commit 13a0599

Browse files
authored
docs: Builder::useVite() helper
1 parent 39150e3 commit 13a0599

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

quick-starter.md

+28
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,34 @@ use App\Http\Controllers\UsersController;
196196
Route::get('/users', [UsersController::class, 'index'])->name('users.index');
197197
```
198198

199+
### Use ViteJs / script type defaults to module
200+
201+
You can also set DataTable to use vitejs by default by registering `Builder::useVite()` inside the `AppServiceProvider`.
202+
203+
```php
204+
namespace App\Providers;
205+
206+
use Illuminate\Support\ServiceProvider;
207+
use Yajra\DataTables\Html\Builder;
208+
209+
class AppServiceProvider extends ServiceProvider
210+
{
211+
public function boot(): void
212+
{
213+
Builder::useVite();
214+
}
215+
}
216+
```
217+
218+
Upon registering, you can now use scripts and without the need to set the type to module.
219+
220+
```php
221+
@push('scripts')
222+
{{ $dataTable->scripts() }}
223+
@endpush
224+
```
225+
226+
199227
<a name="update-default-layout"></a>
200228
## <b>05.</b> Update the default app layout
201229

0 commit comments

Comments
 (0)