Skip to content

Instantly share code, notes, and snippets.

@AhmedHelalAhmed
Created October 16, 2021 17:55
Show Gist options
  • Save AhmedHelalAhmed/204913aa89d2217fe0fed281fbd4a877 to your computer and use it in GitHub Desktop.
Save AhmedHelalAhmed/204913aa89d2217fe0fed281fbd4a877 to your computer and use it in GitHub Desktop.
test docker
<?php
use App\Jobs\LogToFile;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
// redis
//..
Route::get('/test-redis-cache', function () {
Redis::set('name', 'Ahmed Helal');
dd(Redis::get('name'));
});
// database
//..
Route::get('/test-database', function () {
if(!\App\Models\User::count()){
\App\Models\User::factory()->create();
}
dd(\App\Models\User::first()->toArray());
});
// redis as queue driver
//..
Route::get('/test-redis-queue', function () {
dispatch(new LogToFile);
$queueName = 'default';
dd(
'Event dispatched',
Redis::keys('*'),
Redis::llen('queues:' . $queueName)
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment