1 | <?php |
||
10 | trait Sociable |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * SocialConnection relationship |
||
15 | * |
||
16 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
17 | */ |
||
18 | 18 | public function social() |
|
22 | |||
23 | |||
24 | /** |
||
25 | * Link provider to user |
||
26 | * |
||
27 | * @param string $provider |
||
28 | * @param mixed $user |
||
29 | */ |
||
30 | 18 | public function attachProvider($provider, $user) |
|
58 | |||
59 | |||
60 | /** |
||
61 | * Unlink provider from user by provider name(s) |
||
62 | * |
||
63 | * @param string|array $provider |
||
64 | * |
||
65 | * @return int |
||
66 | */ |
||
67 | 3 | public function detachProviderByName($provider) |
|
78 | |||
79 | |||
80 | /** |
||
81 | * Unlink providers from user by provider id(s) |
||
82 | * |
||
83 | * @param string|array $provider |
||
84 | * |
||
85 | * @return int |
||
86 | */ |
||
87 | 3 | public function detachProviderById($provider) |
|
97 | |||
98 | |||
99 | 3 | public function listProviders() |
|
103 | |||
104 | |||
105 | 18 | public function detectOAuthVersion($user) |
|
109 | |||
110 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.