PHP code example of evanschleret / laravel-typebridge
1. Go to this page and download the library: Download evanschleret/laravel-typebridge 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/ */
evanschleret / laravel-typebridge example snippets
declare(strict_types=1);
namespace App\Http\Resources;
use App\Models\User;
use EvanSchleret\LaravelTypeBridge\Attributes\TypeBridgeResource;
use Illuminate\Http\Resources\Json\JsonResource;
#[TypeBridgeResource(
name: 'UserItem',
structure: [
'id' => 'number',
'email' => 'string|null',
'roles' => '@relation(roles)',
'manager?' => '@relation(manager)',
],
)]
final class UserResource extends JsonResource
{
public static string $model = User::class;
}