Filippo Bertilotti
2024-09-20 fcae3d66a172325096b2baeb0a2c45a2117a50d7
inserimento e relazione prodotto e msisdn
3 files modified
32 ■■■■ changed files
app/Http/Controllers/Profiles/ProfilesController.php 7 ●●●●● patch | view | raw | blame | history
app/Vola/Services/FakeSSODatabase/FakeSSODatabaseHandler.php 9 ●●●●● patch | view | raw | blame | history
resources/views/vodafone_fake_sso/show-write-view.blade.php 16 ●●●●● patch | view | raw | blame | history
app/Http/Controllers/Profiles/ProfilesController.php
@@ -81,14 +81,15 @@
    public function showView()
    {
        return view('vodafone_fake_sso.show-write-view');
        $databaseHandler = new FakeSSODatabaseHandler;
        $productsList = $databaseHandler->readProducts();
        return view('vodafone_fake_sso.show-write-view', [ 'productsList' => $productsList ]);
    }
    public function saveUser(SSOFormRequest $request) {
        $data = $request->all();
        //print_r($data);
        $databaseHandler = new FakeSSODatabaseHandler;
        //$databaseHandler->insertDataIntoTables($data);
        $databaseHandler->readProducts();
        $databaseHandler->insertDataIntoTables($data);
        return view("vodafone_fake_sso.db-create-view");
app/Vola/Services/FakeSSODatabase/FakeSSODatabaseHandler.php
@@ -17,9 +17,12 @@
            $userModel = VodafoneUser::create(['Name' => $data["Name"],
                                               'Surname' => $data["Surname"],
                                               'EmailAddress' => $data["EmailAddress"]]);
            Msisdn::create(['MSISDN' => $data["sim_1"],
                            'IdPiano' => $data['IdPiano'],
                            'LinkedUser' => $userModel->id]);
            $msisdnModel = Msisdn::create(['MSISDN' => $data["sim_1"],
                                           'IdPiano' => $data['IdPiano'],
                                           'LinkedUser' => $userModel->id]);
            $product = Products::find($data['products-select']);
            echo "id product: $product->id, id msisdn: $msisdnModel->id ";
            $product->msisdn()->attach($msisdnModel->id);
        }catch(PDOException $e) {
            echo $e->getMessage();
        }
resources/views/vodafone_fake_sso/show-write-view.blade.php
@@ -44,17 +44,15 @@
            Products
        </label>
        <select name="products-select" id="products-select" multiple>
            <option value="1">Product 1</option>
            <option value="2">Product 2</option>
            <option value="3">Product 3</option>
            <option value="4">Product 4</option>
            <option value="5">Product 5</option>
            <option value="6">Product 6</option>
            <option value="7">Product 7</option>
            <option value="8">Product 8</option>
            @foreach ($productsList as $product)
                <option value="{{ $product["id"] }}">
                    {{ $product["id"] }}: {{ $product["Name"] }}
                </option>
            @endforeach
        </select> <br>
        profile_user_name
        <input type="string" name="profile_user_name" id="profile_user_name" value="NAME FAKESSO | DUAL TM9 RIC 5.49275"> <br>
        Custcode