I am trying to use the Bootstrap Switch (http://www.bootstrap-switch.org) with the latest version of Laravel (4.2.8) however I am new to learning this framework and PHP.
I have referenced the four required files within the head of my main index.blade.php file as shown below:
{{ HTML::style('public/bootstrap-switch-style/css/bootstrap-switch.css') }}
{{ HTML::style('public/bootstrap-switch-master/css/bootstrap.css') }}
{{ HTML::script('public/bootstrap-switch-master/js/jquery.js') }}
{{ HTML::script('public/bootstrap-switch-master/js/bootstrap-switch.js') }}
Further down the index.blade.php file I create a checkbox with a value of checked, and attempt to call the function to concert the checkbox to a toggle switch.
<input type="checkbox" name="my-checkbox" checked>
{{$toggle=("[name='my-checkbox']").bootstrapSwitch();}}
The following error appears:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR) Call to undefined function bootstrapSwitch()
Underneath that error an extract of my index.blade.php file is referenced:
<input type="checkbox" name="my-checkbox" checked>
<?php echo $toggle=("[name='my-checkbox']").bootstrapSwitch();; ?>
Has anyone managed to integrate the Bootstrap Switch with Laravel previously, or is there any other way of doing this? Ultimately this is for a staff availability website which which should toggle red for if someone is unavailable, or green for if they are available. The status (boolean) is stored with a MySQL database. Many thanks in advance.