JohnnyW2001

JohnnyW2001

Member Since 2 Years Ago

Experience Points
7,980
Total
Experience

2,020 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
69
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.

Level 2
7,980 XP
Oct
24
1 month ago
Activity icon

Replied to Why Are Environment Variables Not Updated On Deployment?

Interesting. Thanks. config:clear does return a success message oddly enough, but I will explore this.

Activity icon

Replied to Why Are Environment Variables Not Updated On Deployment?

Ok. Im going to try and explain again: Laravel BEHAVES as though the env variables have not been updated. Theres nothing wrong with the settings themselves. This is CONSISTENT.

I can ssh into the server and tinker to view the env variables and they are shown to be the NEW values. While Laravel behaves as if it has the OLD values.

Running config:clear does not solve the problem, but restarting the server DOES.

Oct
23
1 month ago
Activity icon

Replied to Why Are Environment Variables Not Updated On Deployment?

Yes, but that's unrelated. I don't run config:cache during deployment, and even if I did, config:clear should sort that out. Secondly, I don't call any env functions from within my code. The example I gave is APP_DEBUG and I meant it in reference to logging and debug output on crashing.

Oct
22
1 month ago
Activity icon

Started a new Conversation Why Are Environment Variables Not Updated On Deployment?

I've noticed some weird behaviour that I don't understand. When I deploy my app to Amazon Web Services, and then I later make a change to environment variables, Laravel doesn't see the change.

I can go into tinker and run env('APP_DEBUG') and see the new setting, but my app will not use the new setting: It will still share debug information on a crash, even if set to false.

I've tried running php artisan config:clear, assuming it's a caching issue, but even so it doesn't work. It's only after I force AWS to restart the app that the new environment variables are used by my app (and I think only after running config:clear, but I'm not 100% sure about that).

Why does Laravel behave this way? And how can I quickly force it to use the new environment variables when they're changed?

Thanks.

Activity icon

Awarded Best Reply on Assets Not Being Served Over HTTPS

The solution was a trusted proxies issue. You can read more here:

https://laravel.com/docs/5.6/requests#configuring-trusted-proxies

All I had to do (as an AWS Elastic Beanstalk user) was edit app/Http/Middleware/TrustProxies.php:

class TrustProxies extends Middleware
{
    /**
     * The trusted proxies for this application.
     *
     * @var array
     */
    protected $proxies = '*';

    /**
     * The headers that should be used to detect proxies.
     *
     * @var int
     */
    protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB;
}

Now everything is fine.

Oct
10
1 month ago
Activity icon

Replied to Why Is Asset() Not Secure?

Agh! It's an issue with AWS and Load Balancers... and it gets me every time!

Solution here: https://stackoverflow.com/a/51194202/199700

Activity icon

Replied to Why Is Asset() Not Secure?

Thanks. It's really odd. I'm deploying to AWS, but I can see my environment variables, and it's as I expect:

APP_URL: https://www.example.com ("example" inserted for privacy)

I've looked through the Laravel source and it's indeed looking at that variable...

if (! function_exists('asset')) {
    /**
     * Generate an asset path for the application.
     *
     * @param  string  $path
     * @param  bool|null  $secure
     * @return string
     */
    function asset($path, $secure = null)
    {
        return app('url')->asset($path, $secure);
    }
}

So why is it changing it to http://www.example.com? So strange! :(

My local .env file is http://localhost, but that's always what I have it set to. None of those local environment variables are being used anywhere, they're all being replaced by the AWS config.

Activity icon

Started a new Conversation Why Is Asset() Not Secure?

According to Laravel's documentation: "The asset function generates a URL for an asset using the current scheme of the request (HTTP or HTTPS)"

https://laravel.com/docs/master/helpers#method-asset

I have a website hosted at https:// but Laravel is still generating http:// when I used asset(). I don't want to have to force HTTPS through forceScheme or anything, as I've never had to do this before with Laravel and https:// connections. The documentation states it will use the "current scheme".

Activity icon

Replied to Table 'homestead.sessions' Does Not Exist

You can get Laravel to automatically create your sessions table with the command:

php artisan session:table

Sep
12
2 months ago
Activity icon

Replied to Customising Forgotten Password

Perfection! Thanks very much

Activity icon

Started a new Conversation Customising Forgotten Password

I have a system where the user can have an "email" entry into our database before they've created an account. For the rest of our app, we check the status of the password column. If it's NULL then we know they haven't registered yet.

Unfortunately, Laravel only checks for the instance of an email address before sending out a Forgotten Password email. I can write my own little check for a null password column in the sendResetLinkEmail() method, but it feels it would be neater to put the check wherever Laravel checks for the presence of an email address... but where does this happen? (I'm talking about the method that results in the message "We can't find a user with that e-mail address.")

Thanks.

Jun
27
5 months ago
Activity icon

Replied to Custom Pivot Table Not Being Respected?

Thank you! I'm using 5.8 and your tweak made the difference. Not sure why I didn't see it in the docs.

Edit: Because it's not in the docs :-/

https://laravel.com/docs/5.8/eloquent-relationships#defining-custom-intermediate-table-models

Activity icon

Started a new Conversation Custom Pivot Table Not Being Respected?

I'm not sure what I've done wrong, but whenever I try to get a model's attributes from a pivot table, Laravel is looking in the wrong place.

Person model:

  protected $connection = 'second';
  protected $table = 'people';

  public function permissionTypes() {
      return $this->belongsToMany('App\PermissionType')->using('App\PersonPermission');
  }

PermissionType model:

protected $connection = 'second';

public function people() {
    return $this->belongsToMany('App\Person')->using('App\PersonPermission');
}

PeoplePermission model:

class PersonPermission extends Pivot
{
    protected $connection = "second";
    protected $table = "people_permissions";
}

And yet in Tinker:

$person->permissionTypes

Error: Table 'second.permission_type_person' doesn't exist

Why is it looking for permission_type_person? :(