/ app / Http / Services / InboxConnectionServices / DossierInboxConnectionService.php
DossierInboxConnectionService.php
 1  <?php
 2  
 3  namespace App\Http\Services\InboxConnectionServices;
 4  
 5  use App\Models\Dossier;
 6  use App\Models\User;
 7  use Illuminate\Http\Client\Response;
 8  use Illuminate\Support\Facades\Http;
 9  
10  class DossierInboxConnectionService
11  {
12      public static function create(Dossier $dossier): Response
13      {
14          return Http::inbox()->post('/dossiers', [
15              'name' => $dossier->code_year . '-' . $dossier->code_seq,
16              'sgoc_id' => $dossier->id,
17          ]);
18      }
19  
20      public static function update(Dossier $dossier): Response
21      {
22          return Http::inbox()->put('/dossiers/' . $dossier->id, [
23              'name' => $dossier->code_year . '-' . $dossier->code_seq,
24          ]);
25      }
26  
27      public static function delete(Dossier $dossier): Response
28      {
29          return Http::inbox()->delete('/dossiers/' . $dossier->id);
30      }
31  
32      public static function assignUser(Dossier $dossier, User $user): Response
33      {
34          return Http::inbox()->post('/dossiers/' . $dossier->id . '/assign', [
35              'user_id' => $user->id,
36          ]);
37      }
38  
39      public static function deassignUser(Dossier $dossier, User $user): Response
40      {
41          return Http::inbox()->post('/dossiers/' . $dossier->id . '/deassign', [
42              'user_id' => $user->id,
43          ]);
44      }
45  }