Filippo Bertilotti
2024-09-02 56f8c80f9a610c80810b24718340bc9cfd14df07
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace App\Vola\Services\FakeSSODatabase;
 
use App\Models\Msisdn;
use App\Models\VodafoneUser;
use Exception;
use Illuminate\Support\Facades\DB;
use PDOException;
 
class FakeSSODatabaseHandler {
 
    public function insertDataIntoTables(array $data) {
 
        $userArray =
        [
            'Name' => $data["Name"],
            'Surname' => $data["Surname"],
            'EmailAddress' => $data["EmailAddress"]
        ];
 
        $msisdnArray =
        [
            'MSISDN' => $data["sim_1"],
            'IdPiano' => $data["IdPiano"]
        ];
 
        try{
            $userModel = VodafoneUser::create($userArray);
            Msisdn::create(['MSISDN' => $data["sim_1"],
                            'IdPiano' => $data['IdPiano'],
                            'LinkedUser' => $userModel->id]);
 
        }catch(PDOException $e) {
            echo $e->getMessage();
        }
 
    }
 
 
}