Laravel Pass in Boolean Value Via URL
http://example.com/docs?download=true // true http://example.com/docs?download=false // false
http://example.com/docs?download=1 // true http://example.com/docs?download=0 // false
Laravel Request Boolean
To easily get the boolean value, you can call the "boolean" method of the "Request" class and it will like below.
<?php Request::boolean('download'); // true or false
<?php public function store(Request $request) { if ($request->boolean('downloadable')) { // Do something } }
Leave a reply