Skip to content

Instantly share code, notes, and snippets.

View muyaedward's full-sized avatar
😎
Always creating something cool

Edward Muya Mwangi muyaedward

😎
Always creating something cool
View GitHub Profile
@muyaedward
muyaedward / queue-ensure.php
Created July 7, 2018 23:01 — forked from mauris/queue-ensure.php
Laravel Artisan Queue Ensurer - Set a cron job to run this file periodically to ensure that Laravel's queue is processing all the time. If the queue listener stopped, restart it!
<?php
function runCommand ()
{
$command = 'php artisan queue:listen > /dev/null & echo $!';
$number = exec($command);
file_put_contents(__DIR__ . '/queue.pid', $number);
}
if (file_exists(__DIR__ . '/queue.pid')) {
@muyaedward
muyaedward / autocomplete.php
Created July 6, 2017 03:50 — forked from imranismail/autocomplete.php
Laravel And JqueryUI's Autocomplete Plugin
//SearchController.php
public function autocomplete(){
$term = Input::get('term');
$results = array();
$queries = DB::table('users')
->where('first_name', 'LIKE', '%'.$term.'%')
->orWhere('last_name', 'LIKE', '%'.$term.'%')
->take(5)->get();