Member Since 1 Year Ago
4,010 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
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.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Started a new Conversation Is My Socialite Facebook Avatar Code About To Break?
I use Socialite, with Facebook as one of the oauth providers. When a user logs in via Facebook, I save their avatar URL. I then use that URL whenever I need to display their avatar. Those URLs look like this: https://graph.facebook.com/v3.3/USER-ID-HERE/picture?type=normal
Recently, I'm getting developer emails from Facebook warning me that "Changes to token requirements will break your applications function".
Specifically: "Changes to tokenless access for User Picture and FB/IG OEmbed endpoints: By October 24, 2020, developers must leverage a user, app, or client token when querying Graph API for user profile pictures via UID, FB OEmbeds and IG OEmbeds. Developers should provide a user or app token when querying for profile pictures via a UID or ASID, though client tokens are supported as well. Please visit our changelog for User Picture, Facebook OEmbed and Instagram OEmbed for details on how to start calling these Graph API endpoints today."
I'm not sure how to address this. Any ideas?
I decided to add a specific landing page for newly registered users, instead of the normal user home page. Now I can trigger the Analytics goal on the URL of the welcome page. Easier than the alternatives.
Started a new Conversation Laravel User Registration => Google Analytics Goal
Before I make changes to the default Laravel Auth framework, I thought I would ask if anyone has a nice clean way to track new user registrations as a Google Analytics goal.
Because the normal response to a successful registration is to simply redirect to the route specified in $redirectTo, it's not obvious how to best do this.
Started a new Conversation EloquentModel::find(id)->with('relation')
I've been tripped up by this several times.
$user = User::find(1)->with('some_relation')->get()
expecting to get just one record, and what I get is all the users.
Using with() creates a query builder instead, which I guess just ignores the find(id) part altogether. Am I misunderstanding something here?
I use this instead:
$user = User::where(id, 1)->with('some_relation')->get()
But it would be nice if there were an error thrown or something with the original.
I also know that I could do with() first and then find(), but that loads all the records and then keeps only one. I want a query that returns one result.
Replied to Deeper HasManyThrough.. Possible?
I think this is relevant: https://softonsofa.com/laravel-querying-any-level-far-relations-with-simple-trick/ I'm not sure why the CSS seems out of whack on that site today. It was fine when I discovered it a couple of weeks ago. Here's a cleaner looking version via archive.org: https://web.archive.org/web/20170708204600/https://softonsofa.com/laravel-querying-any-level-far-relations-with-simple-trick/
But some of the more recent comments on the original are worth reading.
Replied to Foreach Loop Is Not Working
I suspect your issue is in the controller, and you are not getting the query results you expect. In particular, the declaration looks suspect. You are type-hinting "projects" for the variable $id. Are you sure that's what you mean?
I bet you are sending something that is not an integer $id. If in doubt, do a dd($id) inside the controller and see what you get.
I think this is what you are looking for: https://laravel.com/docs/7.x/eloquent-mutators#date-mutators