Change laravel authenticate response to json format
Add below code to Authenticate.php
abort(response()->json(['message' => 'Unauthorized'], 401));
review: 5⭐- A really nice tool for programmers
How to make check all and uncheck all with jquery
HTML
<input type="checkbox" id="checkAll">Select All
<input type="checkbox" class="candidates">Ola
<input type="checkbox" class="candidates">Brainwave
<input type="checkbox" class="candidates">Mubarak
<input type="checkbox" class="candidates">Atom Bear
JS
$("#checkAll").click(function(){
$('.candidates').not(this).prop('checked', this.checked);
});
Get random element from JavaScript array
Array.prototype.randomize = function () {
return this[Math.floor((Math.random()*this.length))];
}
let arrays = Array('me', 'you', 'us', 'people')
arrays.randomize()
Get random element from array in php
$arrays = ['one', 'two', 'three', 'four'];
echo $arrays[random_int(0, 3)];