hjortur17

hjortur17

Member Since 1 Year Ago

Grindavík

Experience Points 33,060
Experience Level 7

1,940 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 224
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

20 Aug
22 hours ago

hjortur17 started a new conversation Laravel Blade Doesn't Render All From Foreach

Hi, I have a Booking and Service table and a pivot table to connect them. I'm trying to get the services for these bookings but it always renders the else statement:

@if (!$booking->services->isEmpty())
        <div class="flex my-4">
            <div class="w-64 self-center">
                <h3 class="font-light text-xl">Þjónusta:</h3>
            </div>
            <div class="flex-1 text-right">
                <ul>
                    @foreach ($booking->services as $service)
                        <li>
                            <p class="font-bold">{{ $service->description }}</p>
                        </li>
                    @endforeach
                </ul>
            </div>
        </div>
    @else
        <div class="flex my-4">
            <h3 class="font-light text-xl italic">Ekki var valið þjónusta</h3>
        </div>
    @endif

I have a booking inside my database (id: 14) and then I have a row in booking_service (14, 3) and then I have a service in my database (id: 3). And I'm trying to get the description of the service.

It was working before, then I changed from this:

$bookings = Booking::where('dropOffDate', $today)->orderBy('flightTime', 'asc')->get();

to this:

$bookings = Booking::where('dropOffDate', $today) ->orWhere('pickUpDate', $today) ->orderBy('flightTime', 'asc') ->get();

hjortur17 left a reply on Pass Two Where Statement Into Query

No, I am expanding 2 red boxes and 1 green but I get 3 boxes all with green.

hjortur17 left a reply on Pass Two Where Statement Into Query

Okay but how can I render two separate divs? For example border green for dropOffDate and border red for pickUpDate?

@foreach ($bookings as $booking)
        @if ($booking->dropOffDate)
            <div class="border-t-8 border-green-400">
                <h1>{{ $booking->carNumber }}</h1>
            </div>
        @elseif ($booking->pickUpDate)
            <div class="border-t-8 border-red-400">
                <h1>{{ $booking->carNumber }}</h1>
            </div>
        @endif
    @endforeach

hjortur17 left a reply on Pass Two Where Statement Into Query

So I was just using toSql() for debugging. But when I change it to get() I only get one booking, but I'm expect 4 bookings. (2x from dropOffDate and 2x from pickUpDate)

hjortur17 started a new conversation Pass Two Where Statement Into Query

I'm trying to let Laravel get two columns out of the database, like this:

$bookings = Booking::where([
            ['dropOffDate', '=', '06/06/2019'],
            ['pickUpDate', '=', '06/06/2019']
        ])->orderBy('flightTime', 'asc')->toSql();

        dd($bookings);

But this returns:

"select * from `booking` where (`dropOffDate` = ? and `pickUpDate` = ?) order by `flightTime` asc"
19 Aug
1 day ago

hjortur17 started a new conversation Add - After 2 Letters

How do I add a - after 2 letters in a string?

For example. PXT82 => PX-T82

18 Aug
2 days ago

hjortur17 left a reply on Store Function Not Working.

I figured it out, I had a didn't import this BookingConfirmed

But now I get this:

[2019-08-18 20:31:13] production.ERROR: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ')' (View: /home/forge/parkandfly.is/resources/views/emails/confirmed.blade.php) {"userId":3,"exception":"[object] (ErrorException(code: 0): syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ')' (View: /home/forge/parkandfly.is/resources/views/emails/confirmed.blade.php) at /home/forge/parkandfly.is/storage/framework/views/e05b41d641aba257e60a408d94aaf9e21b6ba479.php:138, Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ')' at /home/forge/parkandfly.is/storage/framework/views/e05b41d641aba257e60a408d94aaf9e21b6ba479.php:138)
[stacktrace]

And this happens when I trying to get services connected to a booking:

@forelse($booking->services as $service)
                    <li style="padding-top: 1.5rem;">{{ service->pivot->description }}</li>
                @empty
                    <p>Enginn þjónusta keypt!</p>
                @endforelse

hjortur17 left a reply on Store Function Not Working.

This is what it return if I only dump selectedServicesId :

array:1 [▼
  0 => 7
]

hjortur17 left a reply on Store Function Not Working.

Yes, I'm trying to attach the services to the booking. I have 3 tables, services, services_booking, booking. And I'm trying to add that into it :)

hjortur17 left a reply on Store Function Not Working.

This is what it returned:

"form" => Collection {#217 ▼
    #items: array:19 [▼
      "carNumber" => "pXT82"
      "carSize" => "Fólksbíll"
      "carMake" => "FIAT"
      "carType" => "500X"
      "carColor" => "Hvítur"
      "name" => "Hjörtur Freyr Lárusson"
      "socialId" => "1712992769"
      "email" => "[email protected]"
      "phone" => "8425759"
      "dropOffDate" => "17/09/2019"
      "dropOffTime" => "01:30"
      "pickUpDate" => "30/09/2019"
      "pickUpTime" => "01:15"
      "flightNumber" => "FI123"
      "numberOfDays" => 13
      "priceForDays" => 6500
      "paidPrice" => 27270
      "selectedServicesId" => array:1 [▼
        0 => 7
      ]
      "sessionKey" => "nc8isjremtp82eo7mr9l3l"
    ]
  }

hjortur17 left a reply on Store Function Not Working.

@cronix - I figured it out it was this:

$booking->services()->attach($request->session()->get('form.selectedServicesId'));

            \Mail::to($request->session()->get('form.email'))
                ->cc('[email protected]')
                ->bcc('[email protected]')
                ->bcc('[email protected]')
                ->send(new BookingConfirmed($booking));

hjortur17 left a reply on Store Function Not Working.

@snapey - No haven't done anything custom.

hjortur17 left a reply on Store Function Not Working.

This is the hole .log file: (I ssh into the server)

[2019-08-18 07:00:11] production.ERROR: The Response content must be a string or object implementing __toString(), "boolean" given. {"userId":1,"exception":"[object] (UnexpectedValueException(code: 0): The Response content must be a string or object implementing __toString(), \"boolean\" given. at /home/forge/parkandfly.is/vendor/symfony/http-foundation/Response.php:401)
[stacktrace]

#27 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Routing/Router.php(623): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#28 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Routing/Router.php(612): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#29 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#30 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#31 /home/forge/parkandfly.is/app/Http/Middleware/Cors.php(18): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#32 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): App\Http\Middleware\Cors->handle(Object(Illuminate\Http\Request), Object(Closure))
#33 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#34 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#35 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#38 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#39 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#40 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#41 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#42 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#44 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#45 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#46 /home/forge/parkandfly.is/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#47 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#48 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#49 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#50 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#51 /home/forge/parkandfly.is/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#52 /home/forge/parkandfly.is/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#53 {main}
"}
@@@                                                                                                                                               
17 Aug
3 days ago

hjortur17 left a reply on Store Function Not Working.

Here is the store method:

public function createBooking(Request $request)
    {   
        if ($request->input('reference') === $request->session()->get('form.sessionKey')) {
            $booking = Booking::create([
                'carNumber' => $request->session()->get('form.carNumber'),
                'carSize' => $request->session()->get('form.carSize'),
                'carMake' => $request->session()->get('form.carMake'),
                'carType' => $request->session()->get('form.carType'),
                'carColor' => $request->session()->get('form.carColor'),

                'name' => $request->session()->get('form.name'),
                'socialId' => $request->session()->get('form.socialId'),
                'email' => $request->session()->get('form.email'),
                'phone' => $request->session()->get('form.phone'),

                'dropOffDate' => $request->session()->get('form.dropOffDate'),
                'dropOffTime' => $request->session()->get('form.dropOffTime'),
                'pickUpDate' => $request->session()->get('form.pickUpDate'),
                'pickUpTime' => $request->session()->get('form.pickUpTime'),

                'flightNumber' => $request->session()->get('form.flightNumber'),

                'numberOfDays' => $request->session()->get('form.numberOfDays'),
                'priceForDays' => $request->session()->get('form.priceForDays'),

                'paidPrice' => $request->session()->get('form.paidPrice'),

                'korta_authcode' => $request->input('authcode')
            ]);

            $booking->services()->attach($request->session()->get('form.selectedServicesId'));

            \Mail::to($request->session()->get('form.email'))
                ->cc('[email protected]')
                ->bcc('[email protected]')
                ->bcc('[email protected]')
                ->send(new BookingConfirmed($booking));

            return redirect('/');
        } else {
            dd($request->all());
        }

hjortur17 started a new conversation Store Function Not Working.

I'm trying to store services and send mail when I booking is created. But I always get this error message.

production.ERROR: The Response content must be a string or object implementing __toString(), "boolean" given.

If I add this to my store method:

$booking->services()->attach($request->session()->get('form.selectedServicesId'));

\Mail::to($request->session()->get('form.email')) ->cc('[email protected]') ->bcc('[email protected]') ->bcc('[email protected]') ->send(new BookingConfirmed($booking));

14 Aug
6 days ago

hjortur17 left a reply on Does Laravel Session Has A Unique Key?

I created my own session key to send over to the payment provider

hjortur17 left a reply on How To Use Laravel Session?

Did it like this. I created my own sessionKey

if ($request->input('reference') === $request->session()->get('form.sessionKey')) {
            $booking = Booking::create([
                'carNumber' => $request->session()->get('form.carNumber'),
                'carSize' => $request->session()->get('form.carSize'),
                'carMake' => $request->session()->get('form.carMake'),
                'carType' => $request->session()->get('form.carType'),
                'carColor' => $request->session()->get('form.carColor'),

                'name' => $request->session()->get('form.name'),
                'socialId' => $request->session()->get('form.socialId'),
                'email' => $request->session()->get('form.email'),
                'phone' => $request->session()->get('form.phone'),

                'dropOffDate' => $request->session()->get('form.dropOffDate'),
                'dropOffTime' => $request->session()->get('form.dropOffTime'),
                'pickUpDate' => $request->session()->get('form.pickUpDate'),
                'pickUpTime' => $request->session()->get('form.pickUpTime'),

                'flightNumber' => $request->session()->get('form.flightNumber'),

                'numberOfDays' => $request->session()->get('form.numberOfDays'),
                'priceForDays' => $request->session()->get('form.priceForDays'),

                'paidPrice' => $request->session()->get('form.paidPrice'),

                'korta_authcode' => $request->input('authcode')
            ]);

            // $booking->services()->attach($request->session()->get('form.selectedServicesId'));

            // \Mail::to($request->session()->get('form.email'))
            //  ->cc('[email protected]')
            //  ->bcc('[email protected]')
            //  ->bcc('[email protected]')
            //  ->send(new BookingConfirmed($booking));

            return redirect('/');
        } else {
            dd($request->all());
        }

hjortur17 left a reply on Can't Get Axios Post Response.

UPDATE:

This is because Laravel didn't know what BookingConfirmed was.

If I add this to my store method:

$booking->services()->attach($request->session()->get('form.selectedServicesId'));

\Mail::to($request->session()->get('form.email'))
    ->cc('[email protected]')
    ->bcc('[email protected]')
    ->bcc('[email protected]')
    ->send(new BookingConfirmed($booking));

I get this error: production.ERROR: The Response content must be a string or object implementing __toString(), "boolean" given.

Any idea why?

hjortur17 left a reply on Can't Get Axios Post Response.

Figured it out, $request->input('reference') === $request->session()->get('form.sessionKey')

hjortur17 left a reply on Can't Get Axios Post Response.

Okay, now I'm having a problem that session is returning null.

dd($request->session()->get('sessionKey'));

hjortur17 left a reply on Can't Get Axios Post Response.

Okay, I was taken a look to the response with the network tab and I see that now a laravel_session and then some very long string. Is it possible to match that in the controller?

if(request('laravel_session') == laravel_session) { // THEN DO SOMETHING }

hjortur17 left a reply on Can't Get Axios Post Response.

Okay, changed. Do you still recommend to create a sessionKey and keep that in the session and then match it when the payment is redirected back to me? Or keep the booking number in the session and then proceed it when I get a successful redirect?

hjortur17 left a reply on Can't Get Axios Post Response.

So, do you recommend move the routes to web.php? And that will start a session

13 Aug
1 week ago

hjortur17 left a reply on Can't Get Axios Post Response.

How would I start a session properly?

hjortur17 left a reply on Can't Get Axios Post Response.

I'm not sure it's working fine. Because when I'm redirect-ed back to my site. This outputs null

dd(session()->get('key'));

And this is were I'm inserting it,

$key = $request->all();

        Session::put('key', $key);

        return $key;

hjortur17 left a reply on Can't Get Axios Post Response.

Right now, I'm doing this to start a session: Session::put('key', $key);

hjortur17 left a reply on Can't Get Axios Post Response.

That got the key ;) By returning it

hjortur17 left a reply on Can't Get Axios Post Response.

I have my own method:

sessionKey: function () {
    return Math.random().toString(29).substring(2, 15) + Math.random().toString(29).substring(2, 15);
}

and this post to an endpoint:

public function addKeyToSession(Request $request)
{
    $key = $request->all();

    Session::put('key', $key);
}

and I'm trying to get the sessionKey. Just to see if my function works, after a customer is redirect back to my:

if ($request->input('reference')== session('key')) {
            dd('Amen!');

            request()->validate([
                'carNumber' => 'required',
                'carSize' => 'required',
                'carMake' => 'required',
                'carType' => 'required',
                'carColor' => 'required',

                'name' => 'required',
                'socialId' => 'required',
                'email' => 'required|email',
                'phone' => 'required',
                
                'dropOffDate' => 'required',
                'dropOffTime' => 'required',
                'pickUpDate' => 'required',
                'pickUpTime' => 'required',

                'flightNumber' => 'required',

                'numberOfDays' => 'required',
                'priceForDays' => 'required',

                'paidPrice' => 'required'
            ]);

            $booking = Booking::create([
                'carNumber' => request('carNumber'),
                'carSize' => request('carSize'),
                'carMake' => request('carMake'),
                'carType' => request('carType'),
                'carColor' => request('carColor'),

                'name' => request('name'),
                'socialId' => request('socialId'),
                'email' => request('email'),
                'phone' => request('phone'),

                'dropOffDate' => request('dropOffDate'),
                'dropOffTime' => request('dropOffTime'),
                'pickUpDate' => request('pickUpDate'),
                'pickUpTime' => request('pickUpTime'),

                'flightNumber' => request('flightNumber'),
                'flightTime' => request('flightTime'),

                'numberOfDays' => request('numberOfDays'),
                'priceForDays' => request('priceForDays'),

                'paidPrice' => request('paidPrice'),

                'korta_authcode' => request('authcode')
            ]);

            $booking->services()->attach($request->services);

            \Mail::to($request->email)
                ->cc('[email protected]')
                ->bcc('[email protected]')
                ->bcc('[email protected]')
                ->send(new BookingConfirmed($booking));

            return redirect('/');
        } else {
            dd($request->all());
        }

hjortur17 left a reply on Does Laravel Session Has A Unique Key?

And how can I get a data from that session when a customer comes back to the site after a redirect from another site.

hjortur17 left a reply on Can't Get Axios Post Response.

If I do response.data.sessionKey, I get undefined.

And I'm adding item's to the Session using API because I need to store a booking in a session while a customer goes to another website and pays. And then he is redirect-ed back and I will complete the booking on my end.

hjortur17 left a reply on 405 Error

I was trying to post trough a payment gateway, It was a problem on there end. It just came with 405 because it was a GET method.

hjortur17 started a new conversation Can't Get Axios Post Response.

I can't get the data from axios post request. I'm posting to my api but when I'm trying to debug the data it just returns null.

Here is how I getting it:

addSessionKeyToSession() {
                axios.post('/api/session/add/key', {
                    sessionKey: this.sessionKey
                })
                .then(function (response) {
                    console.log(response.data)
                })
                .catch(function (error) {});
            }

And here is the response without .data:

config:
    adapter: ƒ xhrAdapter(config)
    data: "{"sessionKey":"b2dsm44h98h86ncacp4b89"}"
    ......

(And I'm trying to get sessionKey

hjortur17 started a new conversation 405 Error

I don't know why I'm getting this error, I'm trying to post to https://parkandfly.is/api/booking/create and I have all my routes in api.php not web.php . My routes looks like this:

Route::get('services/get', '[email protected]');
Route::get('car/info/get', '[email protected]');
Route::post('booking/create', '[email protected]');
Route::post('session/add/booking', '[email protected]');

hjortur17 started a new conversation V-Calendar

Hi, I'm having trouble getting v-calendar to work on an iPhone, it works on Samsung and iPad but not an iPhone. Any ideas on how to fix that? If I launch responsive mode in safari it's shows like it's working but when I do php artisan serve and try it in my phone it dosesn't work :/

12 Aug
1 week ago

hjortur17 left a reply on Does Laravel Session Has A Unique Key?

In my case, I don't have any logged-in user.

hjortur17 left a reply on Does Laravel Session Has A Unique Key?

Just for testing, I'm doing it like this:

$form = collect($request->all());

Session::put('form', $form);

return $request->session()->getId();

return session('form');

And this is just for testing, I was thinking to generate a 30 letter word and hash it and store it in the session, and then check if they are the same.

hjortur17 left a reply on Does Laravel Session Has A Unique Key?

So I need to store a booking in the session and then send a session ID over to the payment provider, and after the customer pays, then they will redirect to my site, match up the ID's and continue with the booking.

hjortur17 started a new conversation Does Laravel Session Has A Unique Key?

Does a session have a unique key? And if so, how do I access it?

hjortur17 left a reply on How To Use Laravel Session?

@cronix - How will I fill in the rest of the form? Am I using session or not to keep the data or ?

hjortur17 left a reply on How To Use Laravel Session?

downloadurl is the link the payment site will redirect back to.

hjortur17 left a reply on How To Use Laravel Session?

Alright so you are saying that I should store the booking in my DB, then send over the customer to pay and when they redirect back to my site I will overwrite the Paid field in the DB?

But this is what it says in the docs:

<input name="refermethod" type="hidden" value="POST">
<input name="refertarget" type="hidden" value="_top">
<input name="downloadurl" type="hidden" value="http://www.korta.is/"> // my website link
<input name="reference" type="hidden" value="1234567890"> // for example booking.id / session key

Here is the full docs: https://www.korta.is/docs/web-payments/#using-iframe

hjortur17 left a reply on How To Use Laravel Session?

I talked to them and they said to me to store the data in session and the proceed it when I'm redirected back to my site.

hjortur17 left a reply on How To Use Laravel Session?

How would I do that?

hjortur17 left a reply on Checkbox Value

I did like this, getting the service from database and inserting it to vue

servicesToArray(object) {
                if (this.checked) {
                    if (this.selectedServicesPrices.includes(object.price) && this.selectedServicesDesc.includes(object.description) && this.selectedServicesId.includes(object.id)) {
                        this.selectedServicesId.splice(object, 1);
                        this.selectedServicesDesc.splice(object, 1);
                        this.selectedServicesPrices.splice(object, 1);
                    } else {
                        this.selectedServicesId.push(object.id); 
                        this.selectedServicesDesc.push(object.description); 
                        this.selectedServicesPrices.push(object.price);
                    }
                }
            }
<div v-for="service in services">
                <div v-if="service.carMake === 'Fólksbíll'" class="flex flex-wrap -mx-6">
                    <label class="w-full md:w-1/3 px-3 mb-6 md:mb-0 block">
                        <input class="mr-2 leading-tight" type="checkbox" v-model="isCheckboxChecked" @click="isCheckboxChecked = true, servicesToArray(service)">
                        <span class="font-normal text-white" v-text="service.description"></span>
                    </label>
                </div>
            </div>

hjortur17 left a reply on Get Data From V-model

I did it like this, because I was getting an error saying it could find price/desc

servicesToArray(object) {
                if (this.checked) {
                    if (this.selectedServicesPrices.includes(object.price) && this.selectedServicesDesc.includes(object.description) && this.selectedServicesId.includes(object.id)) {
                        this.selectedServicesId.splice(object, 1);
                        this.selectedServicesDesc.splice(object, 1);
                        this.selectedServicesPrices.splice(object, 1);
                    } else {
                        this.selectedServicesId.push(object.id); 
                        this.selectedServicesDesc.push(object.description); 
                        this.selectedServicesPrices.push(object.price);
                    }
                }
            }
<div v-for="service in services">
                <div v-if="service.carMake === 'Fólksbíll'" class="flex flex-wrap -mx-6">
                    <label class="w-full md:w-1/3 px-3 mb-6 md:mb-0 block">
                        <input class="mr-2 leading-tight" type="checkbox" v-model="isCheckboxChecked" @click="isCheckboxChecked = true, servicesToArray(service)">
                        <span class="font-normal text-white" v-text="service.description"></span>
                    </label>
                </div>
            </div>

hjortur17 started a new conversation How To Use Laravel Session?

Hi, I'm building a booking system in Vue, and I have a web payment on a other site. What I need to do is store my data in the session while the customer goes over to the other site and pay's and then he will be redirect to my site and then a from will be posted and store the booking.

I just can't figure out the best way to store the data in the session. I was thinking to use session key to send over to the payment site and when the customer is redirected I will match the key with the key on my site and post the form. Any good ways, to do this?

Here is my data in vue:

booking: {
                    carNumber: null,
                    carSize: "Bíltegund",
                    carMake: null,
                    carType: null,
                    carColor: null,

                    name: null,
                    socialId: null,
                    email: null,
                    phone: null,

                    dropOffDate: this.dropOffDate,
                    pickUpDate: this.pickUpDate,
                    dropOffTime: "Hvenær mættiru á Leifstöð",
                    pickUpTime: "Hvenær viltu sækja bílinn?",
                    flightNumber: null,
                },
11 Aug
1 week ago

hjortur17 left a reply on How To Remove From Array

Figured it out:

servicesToArray(object) {
    if (this.checked) {
        if (this.selectedServicesPrices.includes(object.price) && this.selectedServicesDesc.includes(object.description)) {
            this.selectedServicesDesc.splice(object, 1);
            this.selectedServicesPrices.splice(object, 1);
        } else {
            this.selectedServicesDesc.push(object.description); 
            this.selectedServicesPrices.push(object.price);
        }
    }
}

hjortur17 left a reply on How To Remove From Array

My data:

checked: false,

                services: [],
                selectedServicesDesc: [],
                selectedServicesPrices: [],

hjortur17 left a reply on How To Remove From Array

If I do this like this:

if (this.checked) {
                    this.selectedServicesDesc.push(object.description);
                    this.selectedServicesPrices.push(object.price);
                } else {
                    this.selectedServicesDesc.delete(object.description);
                    this.selectedServicesPrices.delete(object.price);
                }
<input class="mr-2 leading-tight" type="checkbox" v-model="checked" @click="checked = true, servicesToArray(service)">

It's still not removing it from the array. Any better idea how to do this?

hjortur17 started a new conversation How To Remove From Array

Hi, I have an array that's hold prices for selected prices, and a checkbox to see if we should add to the array or not. But I'm having that issue of if you click the box and then unclick it the price wound reduce. Any ideas how to fix that? Here is my method:

servicesToArray(object) {
    if (this.checked = true) {
        this.selectedServicesDesc.push(object.description);
        this.selectedServicesPrices.push(object.price);
    }

    if (this.checked = false) {
        this.selectedServicesPrices.delete(object.price, 1);
    }
}
<input class="mr-2 leading-tight" type="checkbox" v-model="checked" @click="servicesToArray(service)">
<input class="mr-2 leading-tight" type="checkbox" :value="service.description" hidden>
<span class="font-normal text-white" v-text="service.description"></span>