Skip to content

Instantly share code, notes, and snippets.

View mohammad-fouladgar's full-sized avatar
:octocat:
Focusing

M.Fouladgar mohammad-fouladgar

:octocat:
Focusing
View GitHub Profile
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Fouladgar\OTP\Exceptions\InvalidOTPTokenException;
use Fouladgar\OTP\OTPBroker as OTPService;
use Illuminate\Http\Request;
use Throwable;
<?php
use App\Http\Controllers\AuthController;
use Illuminate\Support\Facades\Route;
Route::controller(AuthController::class)->group(function () {
Route::post('/send-otp', 'sendOTP');
Route::post('/validate-otp', 'verifyOTPAndLogin');
});
<?php
namespace App;
use Fouladgar\OTP\Contracts\SMSClient;
use Fouladgar\OTP\Notifications\Messages\MessagePayload;
class SampleSMSClient implements SMSClient
{
public function __construct(protected SampleSMSService $SMSService)
<?php
namespace App\Models;
use Fouladgar\OTP\Concerns\HasOTPNotify;
use Fouladgar\OTP\Contracts\OTPNotifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable implements OTPNotifiable
@mohammad-fouladgar
mohammad-fouladgar / Dockerfile
Created October 26, 2020 11:57
PHP-dockerize
#
#--------------------------------------------------------------------------
# Image Setup
#--------------------------------------------------------------------------
#
FROM php:7.4.11-fpm-alpine
LABEL maintainer="Fouladgar < [email protected] >"
<?php
use Illuminate\Auth\Events\Registered;
// Register user
event(new Registered($user));
//...
<?php
return [
'sms_client' => App\SampleSMSClient::class,
//...
];
@mohammad-fouladgar
mohammad-fouladgar / SampleSMSClient.php
Last active March 25, 2021 10:59
Implements a SMSClient
<?php
namespace App;
use Fouladgar\MobileVerification\Contracts\SMSClient;
use Fouladgar\MobileVerification\Notifications\Messages\Payload;
class SampleSMSClient implements SMSClient
{
protected $SMSService;
@mohammad-fouladgar
mohammad-fouladgar / Model-MustVerifyMobile.php
Last active February 1, 2020 07:29
Model Preparation for Must Verify Mobile
<?php
namespace App;
use Fouladgar\MobileVerification\Contracts\MustVerifyMobile as IMustVerifyMobile;
use Fouladgar\MobileVerification\Concerns\MustVerifyMobile;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable implements IMustVerifyMobile
@mohammad-fouladgar
mohammad-fouladgar / CustomFilterNamespaceUsage.php
Last active June 30, 2023 08:44
Customize-filter-namespace
<?php
use Fouladgar\EloquentBuilder\EloquentBuilder;
use App\Models\User;
$users = app(EloquentBuilder)
->setFilterNamespace('Domains\\User\\Filters')
->model(User::class)
->filters(request()->filters)
->thenApply()