s1rc

s1rc

Member Since 1 Year Ago

Experience Points 400
Experience Level 1

4,600 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 1
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

15 Mar
2 months ago

s1rc started a new conversation Scheduled Tasks Stopped Running At Midnight

We have two identical Laravel environments, running the exact same configuration even the same Laravel app build.

The backend Laravel worker app has two instances, so we use onOneServer() for each task. The workers are also running Horizon queue.

At midnight last night UTC, the production workers stopped running some tasks, while the dev workers did not. Can Horizon usage (production has much more than dev) have any impact on locking the tasks to one worker preventing it from even starting?

06 Nov
6 months ago

s1rc left a reply on Route Defaulting To Localhost After Passing Through SQS Queue To ElasticBeanstalk Worker

If I set the route to abosolute = false then append the config('app.url'), it seems to work through SQS.

e.g. 'url' => config('app.url') . route('frontend.event.show', ['group' => $this->event->group, 'event' => $this->event], false)

While it's good that this works, I'm confused why absolute routes won't work through SQS.

s1rc left a reply on Route Defaulting To Localhost After Passing Through SQS Queue To ElasticBeanstalk Worker

Here's an example of the toMail() function:

return (new MailMessage)
            ->subject(trans('strings.emails.event.created.subject') . $this->event->group->name)
            ->markdown('mail.event.created', ['group_name' => $this->event->group->name, 'event_title' => $this->event->title, 'url' => route('frontend.event.show', ['group' => $this->event->group, 'event' => $this->event])]);

When I'm working locally, even through SQS the route generates fine. Tinkering some more, on the worker route('frontend.event.show', ['group' => $this->event->group, 'event' => $this->event]) generates correctly.

s1rc left a reply on Route Defaulting To Localhost After Passing Through SQS Queue To ElasticBeanstalk Worker

app.url is the same on the web frontend.

I intercepted the message going through SQS, and the command portion of the message body is quite cryptic, however doesn't seem to make mention of any route. I can see User model passed through the Notification constructor is correct.

s1rc started a new conversation Route Defaulting To Localhost After Passing Through SQS Queue To ElasticBeanstalk Worker

I have a primary web/api Laravel app and a worker Laravel app both running on AWS ElasticBeanstalk. The web/api app is public facing, the worker is not. Both apps have a shared common package, in which the notifications, models, etc. are stored.

Sending mail notifications from the web app to SQS, the worker picks them up and sends them correctly. However the routes in the notifications are not returning the domain of the web app, but instead https://localhost/.

I've checked on the worker, the APP_URL is configured properly (php artisan route:list shows them). Even using tinker config('app.url'); returns the correct URL on the worker.

I know the routes are working, because the models passed to the route() are being resolved to their IDs correctly.

28 Sep
7 months ago

s1rc left a reply on Ordering Results By Sum Of HasMany() Relationships WithCount() Results

Thank you!

I've used hasManyThrough() before, guess I was over complicating things in my mind.

s1rc started a new conversation Ordering Results By Sum Of HasMany() Relationships WithCount() Results

I have a relationship set up as:

Group -> hasMany -> Files
File -> hasMany -> downloads
File -> hasMany -> views

I've ranked the files by the sum of the downloads + views ordering by the results of:

File::withCount(['downloads', 'views'])
->orderByRaw('`downloads_count` + `views_count` desc')

And this works great.

Now I need to rank the Groups by the sum of file downloads + file views.

I've tried:

Group::with(['files' => function($query) {
                $query->withCount(['downloads', 'views'']);
            }])
          ->get();

This eager loads the files and their counted downloads & views. I don't know how to order by the sum of downloads_count + views_count since it's an array. This also seems like it could be inefficient if there are a large number of files.

If I Group::withCount(['files... then I just get the count of the files of course, and I can't figure out how to sort Groups by the sum of all their files downloads + views.

02 Feb
1 year ago

s1rc started a new conversation Mounted Drive To 'storage/' Causes Valid Cache Path Error

I'm running a Laravel app on AWS Elastic Beanstalk, and I want to take advantage of EFS to have a shared storage folder across all instances.

I've mounted the EFS 'drive' to the root 'storage/' folder but I'm getting errors to "Please provide a valid cache path.".

There is a 'storage/framework/cache' folder present, and 'storage/' is writable because the error logs are being written to at 'storage/logs/'.

Is there something else I need to do to allow Laravel to share the storage.path folder?

27 Jan
1 year ago

s1rc left a reply on With The Recent Launch Of AWS EFS, What's A Good Laravel Use Case For It?

We are looking to mount an EFS store to the /storage folder for Elastic Beanstalk applications. Have you run into any issues with multiple load balanced instances sharing the same /storage folder?

05 Jun
1 year ago

s1rc started a new conversation One-to-many Using Bridge Table

I'm setting up relationships between models and I'm wondering if there's any harm using a bridge table for a one-to-many relationship?

i.e. These are some of the models

  • User
  • Team
  • Group

Each User may or may-not have a Team or Group. Would it be better to have nullable FK's in the User model for team_id, group_id, or is using bridge tables team_user, group_user acceptable? (There is little chance this will ever be a many-to-many relationship)

Would there be any ill effects in using a bridge table for one-to-many?