Member Since 2 Years Ago

Experience Points 4,340
Experience Level 1

660 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 37
Best Reply Awards 0
Best Reply
  • 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.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    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.

13 Aug
6 days ago

bramcou left a reply on Laravel Queue Worker Stops After 15min If Started Via Task Schedule But Keeps Running If Started From CLI

On a side note, if switching to AWS or DO, how much CPU and Memory does a Laravel site need. It serves about 250 unique visitors a day, perhaps up to 30 simultaneous and is mainly an administrative website. Not heavy on images or caclulations, just regular db query's and the likes.

bramcou left a reply on Laravel Queue Worker Stops After 15min If Started Via Task Schedule But Keeps Running If Started From CLI

Thanks for your opinion guys.

The only reason that I didn't do that yet is costs, forge would cost us $120 a year + the AWS or DO costs. From what I've read DO is more cost efficient but depending if we'd need either 1 or 2 GB of RAM it would be another $60 or $120 a year. The shared hosting features everything we need except for this part but costs a little under $100 a year.

It's a website for a sports association and I just wanna keep costs to a minimum since eventually, all the members are paying for it.

If I'm missing other advantages or am really misinterpreting the situation, please be blunt (-:

bramcou started a new conversation Laravel Queue Worker Stops After 15min If Started Via Task Schedule But Keeps Running If Started From CLI

Hi all,

I've been running a Laravel website on shared hosting for a couple of years now with a email queue setup. In the process of switching to a new (shared) host and I'm running into trouble with the queue worker.

On the previous host the queue worker kept running for weeks, never needed a restart (only when I forced one after updating the website).

Since I'm on a shared hosting environment I can't install supervisor (do have SSH access) so I use the task scheduler to verify whether the queue worker is still running and if it isn't, the task scheduler restarts the queue worker.

Code to verify if the queue is running:

$path = $this->getPath();

        if (file_exists($path . '/')) {
            $pid = file_get_contents($path . '/');
            $result = exec("ps -p $pid --no-heading | awk '{print }'");
            return $result == '' ? false : true;

        return false;

And the code to restart the queue worker, if it has stopped:

$command = 'php /laravel/artisan queue:work --delay=10 --timeout=30 --sleep=10 --tries=3 > /dev/null & echo $!';
        $number = exec($command);
        file_put_contents($path . '/', $number);

The task scheduler runs this task every minute. After 15 minutes the queue worker stops and the task scheduler restarts it. When I start the queue worker from the CLI it keeps running for hours, no sweat, as long as I keep my CLI terminal open.

When I close my CLI terminal and then restart my CLI and run 'ps aux' the process is still running however (logically) no longer owned by my CLI. In that case, the queue worker also stops after 15 minutes.

No errors in my laravel.log or send to sentry.

  1. Could this be anything else then my hosting environment auto killing unowned processes after they've run for 15 minutes?

  2. Would it be troublesome to work in this configuration with my task scheduler checking the queue worker every minute and then auto restarting the worker every 15 minutes?

  3. sub question: on this new host I have access to a 128mb redis. Used to use the database driver for the queue and now wondering if I should switch to redis. From what I've found on the web it would appear redis would only be preferential when running heavy queue's. Our queue handles, tops, some 100-200 emails a hour, usually no more than 10-20 a hour.

I've figured that I could ask the host if they can allow me to 'whitelist' my queue worker but they pretty clearly state that running deamons isn't allowed in the first place so I think that's probably only gonna get me in trouble..

Always easier to say sorry afterwards then to ask permission beforehand (-:


22 Jun
1 month ago

bramcou started a new conversation Best Way To Add Custom MessageSent Event To Mailer

Hi all,

In my application I send all my emails through a queue. For one Mailable I want to log whether the email has actually been sent. Now the mailer fires a standard MessageSent event which contains the message and the data provided to the mailable, but not the subject, which I also want to log.

So I figured that I have to extend the Illuminate mailer dispatchSentEvent() method to fire a custom event, with the subject. I've figured out one way to do this but I'm doubting whether this is the preferred way to do this.

I figured that I could extend the Illuminate mailer to override the dispatchSentEvent() method. In order to extend the mailer, I know I can create a new mailserviceprovider, which at the minimum extends the default mailserviceprovider registerIlluminateMailer() method so as to register my extended mailer instead of the Illuminate mailer.

This does appear to be a bit of a detour to accomplish my goal. And while a detour by itself isn't that bad, it does have me extend the registerIlluminateMailer() which might change at some point in a newer version of Laravel.

Am I going about this the right way or is there a (way) better way?


P.S. One obvious, way easier, solution would be to simply include the subject in the mailable constructor, however this mailable is a mailable that is used for user customized emails, so it's used to send 10+ different kind of emails and the subject is extracted from the database in the mailable build() method..

14 Dec
8 months ago

bramcou left a reply on From Shared Hosting And Filezilla/Putty To Git.. I'm Lost

Oh lol. How underestimating to thank there wouldn't be a whole laracasts category on this. Thanks.. I'll probably figure it out from there.

Perhaps just one question on the front: can you work with just Git, your local homestead dev area, your remote (production) server and GitLab or GitHub and no other services/party's involved?

bramcou started a new conversation From Shared Hosting And Filezilla/Putty To Git.. I'm Lost

Dear readers,

I'm not that old but learned programming and web development in what seems to be an previous era (-:

Learned PHP in the times of PHP4, eventually got into CodeIgniter and when I picked up web development again two years ago I transitioned to Laravel which was the best thing ever (obviously).

Currently managing a Laravel project for a local society. The project utilizes some queue's, is hooked up to G Suite to manage email groups, uses Sentry for bug tracking. The website is hosted @ A2Hosting, shared hosting but with all the PHP/SSH goodies that I required so far. For about 10 euro a month.

All the time the project's been deployed really old school using Filezilla and Putty. Now that another developer is joining in I want to switch to use Git to manage the versioning. However, I'm getting totally lost and confused in the thousands of available tutorials. Is there anyone recognizing this situation who's been through that phase and can explain which is the best course to go or the best tutorial(s) to read?

Basically what I want is very simple: be able to work independently of each other with a co-developer on the website, preferably beeing able to work on multiple new features in parallel which could be deployed to the server separately once a feature is good 2 go. Would be nice to have a graphical overview of which features are being developed (I understand that to be branches)

I understand either Github or Gitlab would be neccesary for this, however, when reading the Gitlab & Laravel tutorial @ Gitlab I get totally sucked up into something I can't grasp and which seems to be over my head (

I've ended up reading and tutorialing from DigitalOcean and AWS to Forge, to then understanding that Forge comes on top of either DO/AWS or another host. And a ton of other different hosting companies. I am however quit happy with A2Hosting and wouldn't mind staying there if we can simple get the co-working part using Git working there.

Help through this 'jungle' would be sincerely appreciated.


25 May
1 year ago

bramcou left a reply on For Those Who Find Homestead/Vagrant/Virtualbox Slow On Windows

@mistermat solution works aswell and is really quick and easy. Do mind that you add:

  type: "nfs"
  mount_opts: ['nolock,vers=3,udp,noatime,actimeo=1']

For each folder mapping and without the stripes in front of type and mount_opts.


19 May
2 years ago

bramcou started a new conversation Strange Bug: Illuminate\Database\Eloquent\ModelNotFoundException "favicon.ico"

Hi all,

I have a rather strange bug which I just can't figur out, despite quite some efforts. Googled it and can't find any other cases. The bug turns up every few days and the website's used by 50-100 unique users a day. We use Sentry as bugtracker so we have access to a lot of supplementary information if needed.

I'll describe one particular case which happened a few times: Users click a link which directs them to:


Where 7 is the ID of a Model. That controller's code is:

 * Leave a DDWV day
 * @param  integer $ddwv_id
 * @return Redirect
public function leave($ddwv_id)
    //get DDWV
    $ddwv_day = Ddwv::with('users')->findOrFail($ddwv_id);

    $this->authorize('leave', $ddwv_day);

    //user is actually already signed up
    if (! $ddwv_day->users->contains($this->user)) {

        //add usernotification
        UserNotification::store('danger', 'U kunt zich niet afmelden voor deze vliegdag want u bent niet aangemeld voor deze vliegdag.');

        return redirect('/ddwv/vliegdag/' . $ddwv_id);

    //remove user from DDWV day

    UserNotification::store('success', 'U bent succesvol afgemeld voor de vliegdag van: ' . $ddwv_day->flyday_date->formatLocalized('%A %e %B %Y'));

    return redirect('/ddwv');

Then, somehow they end up getting redirected to the following URL: http://xxx.yyy.zzz/ddwv/afmelden-vliegdag/favicon.ico

Some data from Sentry:

  • The above URL is the "referer" header.
  • It happens on any type of device, OS, browser etc.
  • Laravel 5.4, PHP7, MySQL, Shared hosting
  • Stacktrace, top part:
Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\Models\Ddwv] favicon.ico
#51 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(302): findOrFail
#50 app/Http/Controllers/Flightops/DdwvController.php(226): leave
#49 [Anonymous function](0): call_user_func_array
#48 vendor/laravel/framework/src/Illuminate/Routing/Controller.php(55): callAction

Any thoughts? If more (specific) info is required, please just ask.



18 May
2 years ago
16 May
2 years ago

bramcou started a new conversation Architectural Question Regarding Laravel And Mailgun Mailing Lists

Hi all,

I have a architectural question regarding Laravel and Mailgun mailing lists. The Laravel website supports an association in which groups of users can be dynamically created and removed. Now I'm implementing mailing lists with Mailgun.

The administrator can turn on/off a mailing list for his or her group using the Mailgun API. Each time an administrator opens the configuration screen for a group it will display the mailing list settings.

Now I'm doubting between two options (there might be more I haven't thought of):

  1. Just storing the address of the mailing list (in a separate table that has a relationship to the group) in the database. Each time the user opens the config screen, the API will be called to retrieve the settings which will then be displayed.

  2. Storing all the mailing list settings in the mailing lists table. Each time the user opens the configuration screen those settings are displayed. If the user changes one of those settings the API is called to adjust those settings in Mailgun. If that returns 200, the settings are also stored in the database.

I can think of a few advantages and disadvantages.

My main concern with the second option is, what if for any reason, a setting is changed through the Mailgun control panel. Then the database and Mailgun aren't concurring anymore but the users won't notice until something stops working (for instance if the access level of the mailing list is changed). I could build in some sort of daily integrity check but that still doesn't cover it any given time of day..

On the other hand, when each time that the configuration is opened, a API call has to be performed and that puts load on the application. And when Mailgun stops talking back (forgot to pay, troubles, whatever) that will have implications. Of course, those can be catched, but still.

Would really appreciate somebody's input on this.



25 Apr
2 years ago

bramcou started a new conversation 404 Shows Despite Environment = Local

Hi all,

I just installed a custom 404 view. I already have several other custom error views. Those only show when running in production. However, the 404 always shows (when there is cause for then of course), also in the local environment.

Checked the Exception handler (app/exceptions/handler.php) but it doesn't even appear to get that far.. tried looking for some form of middleware that might handle this but it doesn't appear to work that way either.

Please help!



(running L5.4)

23 Mar
2 years ago

bramcou left a reply on Complex Relationship That Takes (too) Long

Hey guys,

Yeah I had tried it, broke my head on it a few times but now.. just after I got to the point of posting the question here I figured it out. With eager loading indeed.


bramcou started a new conversation Complex Relationship That Takes (too) Long

Hi all,

My question is basically: how can I do the following better, as in quicker:

I have 3 tables with a manyToMany relationship: users, memberships and membership_user (this one's the pivot). A user can have multiple memberships (and vv) and the memberships aren't parallel but sequenced.

A simple example: Tom joined the association and became a "new member" on 01-01-2016. Now after one year he becomes a "regular member", on 01-01-2017. After many years he will become a "senior member", say on 01-01-2030.

Our administrators can put in memberships both in the future and in the past, so they can pre-program Tom to become a senior member, 5 years from now.

To determine the user's current membership the application does the following:

     * Gets the current membership from the user
     * Furthermore, we must account for the possibility of having an user with all memberships in the future
     * @return object membership object
    public function getCurrentMembership()
        $membership = $this->memberships->where('effective_date', '<=', date('Y-m-d'))->limit(1);

        //if no records are found this user holds only future memberships, make a new query
        if (! $membership->exists()) {
            $membership = $this->memberships()->limit(1);

        return $membership->first();

This works fine.

Now the problem is that we have about 600~ users and when I want to retrieve, say all senior members I actually have to retrieve all members and then check, member by member, whether they currently hold this particular membership. That's when the application has to do 600 + 1 query's which puts about a second on top of the regular loading time.

I've tried eager loading the pivot table but I can't get that to work and I don't think it's actually meant to be a solution for this challenge.

Now when I started programming some 10 years ago I did actually learn a bit of SQL but I can't figur out how to join this together. Actually I'm not even sure it's possible to join this.

Simplified DB structure:


id | name


id | name


id | membership_id | user_id | effective_date

Any idea's on either: how to do fix this DB-wise or perhaps a (totally) different way to implement the desired functionality?



28 Feb
2 years ago

bramcou left a reply on Can't Access Model Attributes In Constructor

Oh lol, it never occured to me that an accessor could be uses for a non existing attribute.


bramcou left a reply on Can't Access Model Attributes In Constructor

Well, I'd like to be able to pass the $user model straight to the mailable. Therefore it needs to have a $name property which it doesn't natively have (there is no DB column).

How else could I accomplish that?

I'd be glad to learn (-:

bramcou started a new conversation Can't Access Model Attributes In Constructor

Hi all,

I'm having trouble accessing attributes in the constructor of my Auth User model despite running the parent constructor.

Might have to do with the fact that it's the Authentication user model.

public function __construct(array $attributes = array())


This will not work, I can try to DD any property or method but result is NULL. I checked the parents: first is the Auth User model and then Eloquent model.

In the Eloquent model constructor $this->fill($attributes) is called, when I DD there I see that that method is indeed run, with properties but the array is empty here aswell.

So I suppose the Auth class does some non-standard Eloquent setting.

Anybody any idea?

My goal is to set the $name property of the Model in the constructor so I can use it for Mailables.

(I have a temp workaround in the base controller but that's not a pretty one)



17 Feb
2 years ago

bramcou left a reply on Set A Default Date Format For Carbon In Laravel

Thanks for the addition. I had considered it and that's also what the other thread suggests (in a slightly more abstract manner) but it would've been way nicer if Carbon supported some sort of config file where you could set this stuff. It just doesn't appear to have any such thing :p

bramcou left a reply on Set A Default Date Format For Carbon In Laravel

Thanks! Didn't look good enough.

bramcou started a new conversation Set A Default Date Format For Carbon In Laravel

Hi all,

The title pretty much sums up the question: how to define a default date format that carbon uses in Laravel?

Default is now Y-m-d, but I'd like to have it in euro style: d-m-Y and it would be nice if I wouldn't have to force that at each carbon instance.


13 Feb
2 years ago

bramcou left a reply on Should I Use A Service Provider?

Or do put it in a seperate class but have it extend the User model..? (I am providing a instance of User in every method in the new class after all..)

bramcou left a reply on Should I Use A Service Provider?


@SaeedPrez , now I'm thinking.. why not put the methods of getting, adding and deleting the profile photo on the User model.

I suppose that is somewhat inappropriate as it will be putting quite some file handling and manipulating logic in the model, from the other hand, it are methods that edit the state (and db values) of the User.

bramcou left a reply on Should I Use A Service Provider?

Hi guys,

Thanks for all the input. Since I'll be "depending" on Intervention I eventually decided to put it in a service container anyway.

Tough I'm still doubting whether I should downgrade to a helper class..

@SaeedPrez thoughts on that (considering Intervention)?


bramcou started a new conversation Should I Use A Service Provider?

Hi all,

I'm very new to Laravel (coming from CI) and still finding my ways around. Mose of the time I find a problem, different solutions and wonder which solution I should choose.

I'm building an application in which both users and administrators can upload a new profile photo for theirselves/other users.

This means the logic for uploading and resizing a profile photo is gonna end up in two different controllers so I want to put this logic somewhere else and reference it.

Now I wonder, should I put this into a serviceprovider or somewhere else?

I've already made one service provider to store and display notifications to users. That was a rather clear case as I need that functionality on a lot of controllers and I use a viewcomposer to inject the notifications into a specific part of my layout.

However, now I only need this piece of code on (for now) two controllers.. But on the other hand, I wouldn't know a viable solution other than using a service provider. It just sounds like so much effort for such a simple task.

Please help!