Conditions | 2 |
Paths | 2 |
Total Lines | 8 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function getByUser(string $userId):?Context |
||
15 | { |
||
16 | $user = User::where('uuid', $userId)->first(); |
||
17 | $context = DB::table('contexts')->where('id', $user->context_id)->first(); |
||
|
|||
18 | if($context == null){ |
||
19 | return null; |
||
20 | } |
||
21 | return new Context($context->uuid, $context->postal_code, json_decode($context->farmings, true)); |
||
22 | } |
||
34 |