follow best practices when working with blade and javascript

This commit is contained in:
ak-piracha 2023-06-01 11:07:21 +09:30
parent 825a9a384d
commit daf6bcb6d5

View file

@ -71,14 +71,11 @@
@section('moar_scripts') @section('moar_scripts')
<!-- bootstrap color picker --> <!-- bootstrap color picker -->
<?php
$color = request()->old('color', $item->color) ? request()->old('color', $item->color) : '#AA3399';
?>
<script nonce="{{ csrf_token() }}"> <script nonce="{{ csrf_token() }}">
$(function() { $(function() {
$('.color').colorpicker({ $('.color').colorpicker({
color: '{{ $color }}', color: `{{ old('color', $item->color) ?: '#AA3399' }}`,
format: 'hex' format: 'hex'
}); });
}); });