You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then you have to use the `OwnsModels` trait in the models you want to check if they own other models.
18
18
19
19
```php
20
+
<?php
21
+
20
22
use Ownable\OwnsModels;
21
23
use Illuminate\Database\Eloquent\Model;
22
24
@@ -31,6 +33,8 @@ You are now ready to use it.
31
33
## Usage
32
34
33
35
```php
36
+
<?php
37
+
34
38
use Ownable\OwnsModels;
35
39
use Illuminate\Database\Eloquent\Model;
36
40
@@ -59,6 +63,8 @@ if ($user->owns($video, 'the_user_id')){}
59
63
If for some reason the ownership check needs a more complex logic, you can implement the `Ownable` interface inside your ownable objects and then you can define your custom logic in the `isOwnedBy` method. When this method is called the object that called the `owns` method is passed as an attribute to the `isOwnedBy` method.
0 commit comments