braed

braed

Member Since 10 Months Ago

Experience Points 1,550
Experience Level 1

3,450 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 8
Lessons
Completed
Best Reply Awards 1
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.

04 Jan
6 months ago

braed left a reply on Undefined Offset Exception When Accessing A Model's Attribute

@SAURABHD - Thanks for your reply. Price is never null. I have posted a reply of my own after finding the culprit of this issue.

braed left a reply on Undefined Offset Exception When Accessing A Model's Attribute

I have found the problem:

My Option model is using Laravel's attribute casting feature:

protected $casts = [
        'price' => 'decimal'
    ];

braed started a new conversation Undefined Offset Exception When Accessing A Model's Attribute

I have the following example code:

$exhibitor = Exhibitor::first();
$option= $exhibitor->options()->first();

$option has a price attribute that is not mutated. Accessing it gives a Undefined offset: 1 exception:

$option->price; // throws

Why?

17 Nov
8 months ago

braed left a reply on Database Viewer

For those that stumble across this post, Forge now has an offical guide:

https://forge.helpscoutdocs.com/article/9-how-to-connect-to-your-database-using-a-gui-client

braed left a reply on Database Viewer

@ROBSTAR - That's a great point, Robstar. I was developing on my server briefly before launching and wanted to debug an issue which I think turned out to be caching.

10 Nov
8 months ago

braed left a reply on How To Disable User Registration In Laravel 5.7

@EDGESET - This should be the accepted answer, thank you.

04 Nov
8 months ago

braed left a reply on Database Viewer

I didn't realise this was possible but I used my SQL database client (Heidi) to SSH into my Forge server and view my database. I have discovered that the admin user I'm trying to "seed" using User::create() in my create_users_table migration isn't being created.

Would anyone happen to know why?

braed started a new conversation Database Viewer

Laravel Forge is awesome. I'm not (yet?) comfortable using CLI to setup a linux server and Forge makes this a breeze. I'd like to be able to view my database via a GUI.

Is there a simple PHPMyAdmin integration? Might we expect to see a page for viewing our database?

24 Oct
8 months ago

braed left a reply on Artisan Make:model Specify The Directory And Namespace?

For those that have read this thread and are still unsure as to if this works on Windows - it does if you use double quotes like so

php artisan make:model "Models\Post\Post"

30 Sep
9 months ago

braed left a reply on File Upload Store Isn't Working

and what is in storage/avatar_files

Hooray! storage/app contains my Laravel-stored files.

Are my files being stored there because of the FILESYSTEM_DRIVER environment variable?

braed left a reply on File Upload Store Isn't Working

where are you looking

public/avatar_files

braed left a reply on Is There Any Route Alignment/indentation Pattern? (and More Questions)

I really like your second example I can't do that without needing to wrap or scroll as I usually have my project browser open, reducing screenspace.

braed left a reply on File Upload Store Isn't Working

Here's my controller (minus some logic that is definitely not affecting my issue):

$this->validate($request, [
    'file_avatar' => 'nullable|file',
]);
        
if ($request->has('file_avatar')) {
    $file_avatar = $request->file_avatar; // this has a type of UploadedFile
    $avatar_path = Storage::putFile('avatar_files', $file_avatar); // this returns a path to the correct directory, but the file isn't created
}

My form contains an input with the correct name attribute.

29 Sep
9 months ago

braed started a new conversation File Upload Store Isn't Working

I am having trouble uploading and storing a file with Laravel 5.7. My file is being validated and is a valid file. It reaches the controller, where I'm using Storage::putFile('avatar_files', $request->file('file_avatar')). This is returning a path but not creating a file in the specified folder.

Any ideas?

18 Sep
10 months ago

braed left a reply on Socialite Login: This Password Does Not Use The Bcrypt Algorithm

Unfortunately the Socialite Github has Issues disabled, so I can't report this to them. No idea why they would do that.

17 Sep
10 months ago

braed left a reply on Prevent Login Before Email Verification

Thanks for the reply but I think you have misunderstood what I want to achieve. I have the Email Verification working fine using the middleware as you have said.

What I'd like to achieve is preventing the user from logging in before he has clicked the verification email. Instead of having the alert that says "please verify your email ..." on the dashboard, I'd like to have a message on the login form, displayed when a user has correct credentials but hasn't verified their email, that says "please verify your email before logging in".

Does that make sense? :)

braed started a new conversation Prevent Login Before Email Verification

I would like to prevent my users from logging in without having first verified their email address by clicking the link (via the functionality added with Laravel 5.7).

Currently I have added overrode authenticated() in my LoginController and RegisterController like so:

if (!isset($user->email_verified_at)) {
            Auth::logout();
            
            return redirect('/login')
                ->withErrors([
                    'email' => 'Please verify your email address by clicking the link in the email we sent.<br>'
                        . 'If you did not receive an email, <a href="' . '/email/verify' . '">click here to resend</a>.',
                ])->withInput();
        }
        
        return redirect($redirectTo);

For some reason, this is now preventing the user from being email verified. Also, logging the user in and then logging the user back out if they aren't email verified seems awfully backwards and inefficient. Can someone tell me a proper way to do this? Thanks!

16 Sep
10 months ago

braed left a reply on How To Add Variable Data To Javascript

JS is quite easy to debug using your browser's console. You can google the exceptions as you learn them but in this case window.open.brandUrl; should be window.open(brandUrl); :)

braed left a reply on How To Add Variable Data To Javascript

Are you trying to use your PHP variable inside of a JS file? If you are, that's not possible without first setting the variable inside of your view.

In your view: <input id="brandUrl" type="hidden" value="{{ $brand->url }}"> In your JS file: let brandUrl = document.getElementById('brandUrl').value;

If you don't want to use a hidden input element you can do this: ` let brandUrl = json_encode("{!! $brand->url !!}");

`

braed left a reply on How To Add Variable Data To Javascript

Have you tried {!! $brand->url !!}?

braed started a new conversation Laravel Socialite Login: This Password Does Not Use The Bcrypt Algorithm

I have added Socialite social authentication to my Laravel 5.7 project, updating the User model to have a nullable password since OAuth2 doesn't require a password.

Trying to login to the account made via Socialite using the same email and any password gives a This password does not use the Bcrypt algorithm. exception, which I assume is because Laravel is attempting to decrypt the null password from the database to check against the password from the login form.

A simple solution might be to just supply the auth token as the user password - it's a long string that can't be guessed and, like my OAuth2 token, would be stored encrypted.

Alternatively, I might have the user create a password after authenticating with OAuth2 but before their account is created and added to the database.

Might there be a more elegant solution?

Edit: It seems that the algoName in the following method in BcryptHasher is returning unknown.

public function check($value, $hashedValue, array $options = [])
{
    if ($this->info($hashedValue)['algoName'] !== 'bcrypt') {
        throw new RuntimeException('This password does not use the Bcrypt algorithm.');
    }

    return parent::check($value, $hashedValue, $options);
}

I'm not sure how to see what is calling check() in order to debug further but it's certainly related to Socialite.