Udostępnij ze wszystkimi ostrzami w Laravel
public function boot() {
view()->share('data', [1, 2, 3]);
}
Noob Learner
public function boot() {
view()->share('data', [1, 2, 3]);
}
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin="anonymous"></script>
<script src="{{ asset('js/share.js') }}"></script>