1. Go to this page and download the library: Download quvel/core library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Quvel\Core\Facades\Captcha;
$result = Captcha::verify($token, $request->ip());
if ($result->isSuccessful()) {
// Continue with request
}
// Check reCAPTCHA v3 score
if ($result->hasScore() && $result->score >= 0.5) {
// High confidence user
}
Route::post('/register', function () {
// Protected by captcha
})->middleware('captcha');
// Custom input field
Route::post('/login', function () {
// ...
})->middleware('captcha:recaptcha_response');
use Quvel\Core\Contracts\CaptchaDriverInterface;
use Quvel\Core\Captcha\CaptchaVerificationResult;
class HCaptchaDriver implements CaptchaDriverInterface
{
public function verify(string $token, ?string $ip = null, ?string $action = null): CaptchaVerificationResult
{
// Your verification logic
return CaptchaVerificationResult::success();
}
public function supportsScoring(): bool
{
return false;
}
public function getDefaultScoreThreshold(): ?float
{
return null;
}
}
use Quvel\Core\Models\UserDevice;
// Get active devices for a user
$devices = UserDevice::forUser($userId)->active()->get();
// Find by device ID
$device = UserDevice::where('device_id', 'device-123')->first();
// Check if device has valid push token
if ($device->hasValidPushToken()) {
// Send notification
}
// Platform filtering
$iosDevices = UserDevice::forPlatform('ios')->get();
use Quvel\Core\Facades\PushNotification;
$success = PushNotification::sendToDevice(
device: $device,
title: 'New Message',
body: 'You have a new message',
data: ['message_id' => 123]
);
$results = PushNotification::sendToDevices(
devices: $devices,
title: 'Update Available',
body: 'A new version is available'
);
// Returns: ['device-123' => true, 'device-456' => false, ...]
use Quvel\Core\Facades\Targeting;
// Get devices for targeting scope
$devices = Targeting::getTargetDevices(
requestingDevice: $device,
userId: auth()->id(),
scope: 'all_user_devices' // or 'requesting_device'
);
// Then send to those devices
PushNotification::sendToDevices($devices, $title, $body);
use Quvel\Core\Contracts\PushDriver;
use Quvel\Core\Models\UserDevice;
class CustomPushDriver implements PushDriver
{
public function getName(): string
{
return 'custom';
}
public function supports(string $platform): bool
{
return $platform === 'my-platform';
}
public function isConfigured(): bool
{
return !empty(config('services.custom_push.api_key'));
}
public function send(UserDevice $device, string $title, string $body, array $data = []): bool
{
// Your sending logic
return true;
}
}
app(PushManager::class)->extend('custom', function () {
return new CustomPushDriver();
});
use Quvel\Core\Events\PushNotificationSent;
use Quvel\Core\Events\PushNotificationFailed;
Event::listen(PushNotificationSent::class, function ($event) {
Log::info('Push sent', [
'devices' => $event->deviceIds,
'title' => $event->title,
]);
});
use Quvel\Core\Concerns\HasPublicId;
class Order extends Model
{
use HasPublicId;
}
$order = Order::create([...]);
echo $order->public_id; // '01HQ...' (ULID) or 'uuid-here'
// Find by public ID
$order = Order::wherePublicId('01HQ...')->first();
Route::get('/orders/{order:public_id}', function (Order $order) {
return $order;
});