Add all files
This commit is contained in:
27
app/Helpers/ApiDocumentation/RequestUserExtension.php
Normal file
27
app/Helpers/ApiDocumentation/RequestUserExtension.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\ApiDocumentation;
|
||||
|
||||
use App\Models\User;
|
||||
use Dedoc\Scramble\Infer\Extensions\Event\MethodCallEvent;
|
||||
use Dedoc\Scramble\Infer\Extensions\MethodReturnTypeExtension;
|
||||
use Dedoc\Scramble\Support\Type\ObjectType;
|
||||
use Dedoc\Scramble\Support\Type\Type;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RequestUserExtension implements MethodReturnTypeExtension
|
||||
{
|
||||
public function shouldHandle(ObjectType $type): bool
|
||||
{
|
||||
return $type->isInstanceOf(Request::class);
|
||||
}
|
||||
|
||||
public function getMethodReturnType(MethodCallEvent $event): ?Type
|
||||
{
|
||||
if ($event->name === 'user') {
|
||||
return new ObjectType(User::class);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user