### Install Connections for Laravel via Composer Source: https://github.com/roundly-consulting/connections-for-laravel/blob/main/README.md Install the package with Composer, then publish and run the migrations. Requires PHP 8.4 and Laravel 12 or 13. Set CONNECTIONS_KEY_TYPE=uuid or ulid before migrating if your models use UUID or ULID keys. ```bash composer require roundly-consulting/connections-for-laravel php artisan vendor:publish --tag="connections-migrations" php artisan migrate ``` -------------------------------- ### Create, Check, and Manage Connections with Permissions and Expiry Source: https://github.com/roundly-consulting/connections-for-laravel/blob/main/README.md Connect two models with permissions and an optional expiry, then check existence, verify wildcard permissions, grant additional permissions, check permission through a connection, disconnect (soft delete), and prune expired connections. ```php use RoundlyConsulting\Connections\Facades\Connections; Connections::between($user, $team) ->withPermissions('view', 'posts.*') ->expiresIn(now()->addMonth()) ->connect(); Connections::between($user, $team)->exists(); // true — active connection Connections::between($user, $team)->permissions()->has('posts.edit'); // true — wildcard match Connections::between($user, $team)->permissions()->grant('publish'); $user->hasPermissionThroughConnection($team, 'publish'); // true Connections::between($user, $team)->disconnect(); // soft delete Connections::prune(); // drop expired connections ``` -------------------------------- ### Make an Eloquent Model Connectable with HasConnections Source: https://github.com/roundly-consulting/connections-for-laravel/blob/main/README.md Use the HasConnections trait and implement the Connectable contract to enable connections on a model. Apply this to each model that participates in connections, such as Team or User. ```php use Illuminate\Database\Eloquent\Model; use RoundlyConsulting\Connections\Concerns\HasConnections; use RoundlyConsulting\Connections\Contracts\Connectable; class Team extends Model implements Connectable { use HasConnections; } ```