jaydubyasee

jaydubyasee

Member Since 2 Years Ago

Clevedon

Experience Points 34,230
Experience Level 7

770 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 341
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.

03 Jul
3 weeks ago

jaydubyasee left a reply on Prop 'animals' Requires Default Value To Be Set

If you know that the prop is always going to contain something you could do away with default by adding required.

props: {
    animals: {
        type: [Array, Object],
        required: true
    }
}
11 Oct
9 months ago

jaydubyasee left a reply on Testing A Random Field

@D9705996 Thanks for this but how does this affect the test? I can see that the stub contains the "Day" each time but my test still randomly generates a select box containing either days, months or years. How does the stub get incorporated into the assertion?

10 Oct
9 months ago

jaydubyasee left a reply on Testing A Random Field

@D9705996 The form is for members whose data we already hold so we already know the date of birth and can check what the member enters matches our records.

As for a test for each mechanism - that's just the issue. When running a browser test, in order for the test to pass, I need the test to select the correct day/month/year matching the test user that I create but the browser test doesn't know whether to enter the day, month or year.

    /**
     * @test
     */
    public function DOB_must_match_database()
    {
        factory(Member::class)->create([
            'confirmation_code' => '123456789',
            'dob'               => '25/04/1966',
            'niNumber'          => 'DB123455E',
        ]);

        $this->visit('/register')
            ->type('123456789', 'confirmation_code')
            ->type('DB', 'niNumber')
            ->select('1966', 'dob')
            ->press('Continue')
            ->see('Register (Page 2)');
    }

This will only work if the system has chosen "YEAR" as the field to prompt for otherwise the test will fail.

jaydubyasee started a new conversation Testing A Random Field

I have a registration form which prompts the user to enter either their day, month or year of birth. The choice of day/month/year is randomly decided by the controller each time the form loads. The system then uses this (along with other identifying information entered) to check the corresponding member record and display the next page in the registration process.

My problem is how to set up a test which simulates user input when I don't know which data item the system will ask for?

Controller

    public function showRegistrationForm()
    {
        $datePart = array_rand(['Day' => 'Day', 'Month' => 'Month', 'Year' => 'Year']);
        // random day, month or year
        $dateArray = Utils::getAllDaysMonthsYears($datePart);

        return view('auth.register')
            ->with('datePart', $datePart)
            ->with('dateArray', $dateArray);
    }

View

            <div class="form-group{{ $errors->has('dob') ? ' has-error' : '' }}">
                {{ Form::label('dob', "$datePart of birth", ['class' => ' control-label']) }}

                <div class="rounded-select dob">
                    {{Form::select('dob',
                    $dateArray,
                    old('dob'),
                    ['class' => 'form-control correct-drpdwn-height', 'required' => 'required', 'size' => 1])}}
                    {{ Form::hidden(
                        'dobPart',
                        $datePart
                        )
                    }}
                </div>

                @if ($errors->has('dob'))
                    <span class="help-block">
                        <strong>{{ $errors->first('dob') }}</strong>
                    </span>
                @endif

            </div>
03 Jul
1 year ago

jaydubyasee left a reply on PhpStorm Initialize Fields

It is possible to change the default from private.

Project Settings (Ctrl + Alt + S) => Editor => Code Style => PHP => Code Generation tab => Fields Default Visibility.

30 May
1 year ago

jaydubyasee left a reply on VS Code Xdebugging Throws DecryptException: The Payload Is Invalid.

I get the same problem and although I don't know what's generating the exception I was able to suppress the debugger reporting it by making sure the "Everything" checkbox is clear in the debugger breakpoints.

09 May
2 years ago

jaydubyasee left a reply on Eloquent "where" Not Working

Okay, gave up trying to understand the problem. Changed the Utils::generateRandomString(); function generate a more random string and now I get no duplicate with 30,000 records.

jaydubyasee left a reply on Eloquent "where" Not Working

Yup tried that as well. No luck. Should have mentioned that I've tried:

$member = Member::where('confirmation_code', $confirmationCode)->first();
$member = Member::where('confirmation_code', '=', $confirmationCode)->first();
$member = Member::where('confirmation_code', '=', $confirmationCode)->get();

Also tried with and without unset($member). It just seems that $member->isEmpty() is true whether Member::where(...) finds an entry on the db or not.

jaydubyasee left a reply on Eloquent "where" Not Working

I had first() originally but it didn't work either. I changed it to get() to see if the first() was the problem.

08 May
2 years ago

jaydubyasee started a new conversation Eloquent "where" Not Working

I'm trying to generate an 8 character random unique reference code.

My seeder is calling this function

    public static function generateUniqueConfirmationCode()
    {
        $found = false;
        $confirmationCode = '';
        while (!$found) {
            unset($member);
            $confirmationCode = Utils::generateRandomString();
            $member = Member::where('confirmation_code', $confirmationCode)->get();
            if ($member->isEmpty()) {
                $found = true;
            } 
        }

        return $confirmationCode;
    }

but the Member::where('confirmation_code', $confirmationCode)->get() line is not finding if the confirmation code already exists on the table and as a result duplicates are being created.