Overview
TheResource model represents a NetBird resource that has been successfully created and associated with a user. This model stores the mapping between users and their NetBird resources.
Database Table
Table Name:resources
The resources table stores approved and created NetBird resources with their associations.
Properties
Fillable Attributes
The unique identifier for the resource in NetBird’s system.
The ID of the user who owns this resource.
The identifier of the user who created this resource (typically an email address).
Timestamps
The model automatically manages the following timestamps:Timestamp when the resource was created
Timestamp when the resource was last updated
Relationships
user()
Defines a belongs to relationship with the User model.Methods
isOwnedBy()
Checks if the resource is owned by a specific user.The user instance to check ownership against
bool - True if the resource belongs to the specified user, false otherwise
Example:
Usage Examples
Creating a Resource
Querying Resources
Checking Ownership
Model Location
Namespace:App\Models\Resource
File: app/Models/Resource.php:9
This model extends
Illuminate\Database\Eloquent\Model and uses standard Laravel Eloquent features.