braed

braed

Member Since 1 Year Ago

Experience Points
1,550
Total
Experience

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.

Level 1
1,550 XP
Jan
04
9 months ago
Activity icon

Replied to 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.

Activity icon

Replied to Undefined Offset Exception When Accessing A Model's Attribute

I have found the problem:

The Option model is using Laravel's attribute casting feature but isn't specifying the number of decimal places:

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

The fix is declaring decimal places when casting. In this case, adding :2 to the decimal value:

protected $casts = [
        'price' => 'decimal:2'
    ];
Activity icon

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 of data type decimal that is not mutated. Accessing it gives a Undefined offset: 1 exception:

$option->price; // throws

Why?

Nov
17
10 months ago
Activity icon

Replied to Database Viewer

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

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

Activity icon

Replied to 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.

Nov
10
11 months ago
Activity icon

Replied to How To Disable User Registration In Laravel 5.7

@EDGESET - This is the Laravel way and should be the accepted answer, thank you.

Nov
04
11 months ago
Activity icon

Replied to 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. Thanks for your comments.

Activity icon

Started a new conversation Database Viewer

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?

Oct
24
11 months ago
Activity icon

Replied to 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"

Sep
30
1 year ago
Activity icon

Replied to File Upload Store Isn't Working

and what is in storage/avatar_files

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

Are my files being stored there because the FILESYSTEM_DRIVER environment variable defaults to local?

Is there any reason why I might want to store my files in storage/ and not public/ ?

Edit: I have just read the docs properly!

Activity icon

Replied to File Upload Store Isn't Working

where are you looking

public/avatar_files

Activity icon

Replied to Is There Any Route Alignment/indentation Pattern? (and More Questions)

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

Activity icon

Replied to 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 string with a unique file name and path to the correct directory (avatar_files/pkKhjw1GpUGKQbmA8H6djpeFU9j4qrIH1uZqUWqM.jpeg), but the file isn't created
}
Sep
29
1 year ago
Activity icon

Started a new conversation File Upload Store Isn't Working

I am having trouble storing an uploaded file with Laravel 5.7 on Windows.

My file reaches the controller and is being validated. IsValid() returns true.

I'm using Storage::putFile('avatar_files', $request->file('file_avatar')) which is returning a path but not creating a file in the specified folder.

Any ideas?

Sep
18
1 year ago
Activity icon

Replied to 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.

Sep
17
1 year ago
Activity icon

Replied to 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? :)

Activity icon

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 with a call to a function like so:

protected function requireEmailVerfication(Request $request, $user, $redirectTo)
    {
        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 - I click the email link and I get redirected to the login page but the user hasn't been verified in the database. 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!

Sep
16
1 year ago
Activity icon

Replied to 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); :)

Activity icon

Replied to 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:

function myFunction() {
      let brandUrl = document.getElementById('brandUrl').value;
      window.open(brandUrl);
};

If you don't want to use a hidden input element you can do this:

<script>
let brandUrl = json_encode("{{ $brand->url }}");
</script>
Activity icon

Replied to How To Add Variable Data To Javascript

Replace {{ $brand->url }} with {!! $brand->url !!}

Activity icon

Started a new conversation 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.

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.