Recently, we introduced some breaking updates by which many developers are getting something from the following errors:
- datatables_css.stub failed to open stream
- datatables_js.stub failed to open stream
- View [datatables_css] not found
- View [datatables_js] not found
Problem:
so, the purpose of this breaking update was, till now when we generate CRUD with datatables we were including datatable scripts into table.blade.php something like the following:
{!! $dataTable->table(['width' => '100%']) !!}
@section('scripts')
{!! $dataTable->scripts() !!}
@endsection
And the main CSS files for datatables were included in the layout file layout/app.blade.php, also some js files were also included in the same folder. Like following,
So the problem that we found was when we want to update the datatables version, we have to go to each file and update them manually. Also, there were some redundant JS and CSS files that were included in both table.blade.php & app.blade.php.
Solution:
As a solution, we decided to move these things to two partial files datatables_css.blade.php & datatables_js.blade.php. Which were published during the publishing layout.
php artisan infyom.publish:layout
so if anyone is getting this error then, run composer update to update your code to the latest commits and then try to run the above command and publish these two files into your layouts folder. As an alternative, you can also create those files manually from the templates and can update your layout file accordingly.
If anyone is still facing issues after performing these steps, then please post your comments below.