Member Since 2 Years Ago


PHP developer at Double Take Pigeon

Experience Points 16,550
Experience Level 4

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 161
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.

11 Sep
4 days ago

jeffreyvanrossum commented on Reflect Into Functions

For those wondering, the IDE theme is probably Nord: (Sorry about that)

01 Sep
2 weeks ago

jeffreyvanrossum left a reply on Validate Relationship Owner

@nakov I feel a little dumb for asking now, but I don't regret it. :P

Thanks again!

jeffreyvanrossum left a reply on Validate Relationship Owner

@nakov Thanks, I had already done this. But I think this doesn't account for the situation in the use case in the initial post.

Let's say you have a "Create order" form. In the form, you have a dropdown with all the customers that belong to the current user. However, if one wanted it could easily alter the values (using dev tools inspect element for example) of a customer id to one that doesn't belong to this current user.

So then you can end up with an order with a customer assigned that doesn't belong to the user.

Or is that already taken care of somehow when you define the relationship method in the model like you suggested?

Edit: Upon reading your post again, I only now noticed your scope auth()->user()->customers... on the current user. I guess that should do the trick indeed.

jeffreyvanrossum started a new conversation Validate Relationship Owner

Hi all,

What is the best way to validate relationship attachment?

Example use case: a user creates an order and assigns it to a customer through a web form. However, one could abuse the form and alter the customer_id to a customer that doesn't belong to the current user.

So I am working on this from the OrdersController in the store-method.

One thing you could do is just do a simple conditional check (which feels dirty), like this:

if ( (App\Customer::findOrFail(request('customer_id'))->user_id !== auth()->id() ) {
   abort(401); // unauthorized

Another way, that to me feels much better, is to create a custom validation rule. You could make it so it is usable for other models as well.

The rule could look something like this:


namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;

class Ownership implements Rule
     * @var Model
    protected $model;

     * Construct
     * @param string $model The model that is being checked.
    public function __construct($model)
        $this->model = new $model;

     * Determine if the validation rule passes.
     * @param  string  $attribute
     * @param  mixed  $value
     * @return bool
    public function passes($attribute, $value)
        return ($this->model->findOrFail($value))->user_id === auth()->id();

     * Get the validation error message.
     * @return string
    public function message()
        return 'This object does not belong to you.';

And then within the controller validation, you can validate like this:

   'customer_id' => ['required', 'string', new Ownership('App\Customer')]

Anyway, I was wondering if I am missing out on a function/feature in Laravel with which this can be done better?

Perhaps this can be done within a Policy? However, I don't know if gates are intended to use the Request object.

Looking forward to see how others solve these sort of situations.

22 Aug
3 weeks ago

jeffreyvanrossum left a reply on Jobs Are Somehow Being Cached With Horizon/supervisor

I think, but I'm not sure if it applies to your exact situation, your jobs are stored in memory. When changing the code you should therefore restart your worker.


08 Aug
1 month ago

jeffreyvanrossum left a reply on Laravel Forge Database Section

I have only used MySQL on Forge, so I don't know if there is a difference with PostgreSQL. At least with MySQL you should be able to add and delete databases and database-users. Click on your server through the 'Servers' menu, and then on the left click 'Database'.

To view my current databases I use a SSH connection through SequelPro ( Maybe for PostgreSQL you can use Haven't used it myself.

06 Aug
1 month ago

jeffreyvanrossum left a reply on Advice Regarding Scheduled Tasks

Hi @ejdelmonico, Thanks. I have set it up that way. :) Do you now if there is a difference in the handling of a Command or a Job?

jeffreyvanrossum left a reply on 403 - This Action Is Unauthorized

Your posting to the ProfilesController in your routes file.

Route::patch('/c/{procedure}', '[email protected]');

jeffreyvanrossum started a new conversation Advice Regarding Scheduled Tasks

Hi all,

I've made a script that needs to run every morning and potentially send out emails.

I've created a job ( for this and have implemented it to run daily in the schedule function of Kernel.php.

I think this works, but I wonder if it is the correct usage for jobs? Or should it rather be a Command class instead (

The script fetches unpaid invoices and checks if it's due to send a reminder. Advice is appreciated.

03 Aug
1 month ago

jeffreyvanrossum left a reply on Choosing A New Host - Aws Lightsail Or Another Vps

I actually started using Forge two days ago and so far it has been a very pleasant experience. It handels the server configuration for you and makes it really easy to deploy code. Also now using Digital Ocean for the first time (5$ per month variant for now).

30 Jul
1 month ago

jeffreyvanrossum commented on Flash Messaging With Vue

Just a quick tip, you can implement the following snippet directly after require('./boostrap'); in your app.js. = new Vue();

window.flash = function( message ) {$emit('flash', message);
25 Mar
5 months ago

jeffreyvanrossum left a reply on BelongsToMany, But Only Sometimes

I don't know if this is the best way, but I think you can apply a condition on the relation.

return $this->belongsToMany('App\Post')->where('attribute', 'the required value);

I would be interested to know if there is a better way too.

jeffreyvanrossum started a new conversation Using Api:auth But Still Make Unauthenticated Route Available


Is it possible to make a API route available, both authenticated and not-authenticated?

I could of course remove the middelware on the specific route, and then apply some conditional logic in the controller. However, I'm using Auth::check to determine if someone is logged in. This will then always return false, because the request doesn't go through the api:auth middleware.

Basically, what I am trying to achieve:

Route::middleware('auth:api')->get('/posts', '[email protected]'); 
Route::get('/posts', '[email protected]'); 

Any advice is appreciated!

14 Mar
6 months ago

jeffreyvanrossum left a reply on How Development Process Works After Production?

I deploy my changes with GitFTP-Deploy. You can basically commit your changes to production that way. Works good. One thing I still have to figure out, is how to go about running migrations and composer (vendor) updates. Ideally, when deploying php artisan migratie and composer update (not sure if that one is correct) are run.

03 Aug
2 years ago

jeffreyvanrossum left a reply on Login From External Website

Thanks Jestins!

I did end up doing it a bit differently, might very well be not the best solution, but anyway;

  • User successfully logs in at the WordPress-site.
  • Via my Laravel API there is a authentication token created and returned to WP.
  • WordPress redirects (with form submit) to Laravel and if token matches authentication is done.
  • Laravel redirects back to WordPress or stays at Laravel (depends on situation).

jeffreyvanrossum started a new conversation Login From External Website

Hello everyone,

I was wondering if it is possible to log into a Laravel application from a different website.

My situation is as follows;

Main website This is a WordPress website where users can subscribe on a couple of things including the Laravel application. They have a user account on this website.

Laravel application There is a overlap between the users in this application and in the main website. They have to login separately, but I did make it so that they can login with the same credentials. The application is hosted on a different server.

What I would like to achieve is that when a user logs in on the main website, it is automatically also logged in in the Laravel application.

Side note; I'm using a token based API but I can't seem to be able to log someone in through the API. Also; I'm not using Passport at this moment.

Hoping that someone here can point me in the right direction.

06 Oct
2 years ago

jeffreyvanrossum left a reply on How To Add Additional Functions To A Package

Thanks, especially @ahuggins. I tried your suggestions and got closer, but still errors (now the instance was missing the API-key) - so I got a bit tired of this package. I might very well have just used it wrong, however, I now use this one:

That was a lot easier to get working, at least, for me.

Now in my controller I can use it like this:

$campaigns =  Newsletter::getApi()->get('campaigns', [
     'count' => 10

Thanks again!

05 Oct
2 years ago

jeffreyvanrossum left a reply on How To Add Additional Functions To A Package

Thank you very much. I've done all that, I do get an error calling the functions from within a controller. Error is as follows: Non-static method App\Mailchimp::getCampagnes() should not be called statically, assuming $this from incompatible context

So apparently I can't use it like this Mailchimp::getCampagnes(10,'regular');.

Controller code:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;

use App\Mailchimp as Mailchimp;

class CampagnesController extends Controller
    public function index() {
      return Mailchimp::getCampagnes(10,'regular');

jeffreyvanrossum left a reply on How To Add Additional Functions To A Package

I will give that a try @ahuggins. It sounds logical. How would you go about this?

Thank you both for answering!

jeffreyvanrossum started a new conversation How To Add Additional Functions To A Package


I'm using a MailChimp package for Laravel which does not contain a lot of functions. I would like to add a function to call campagnes for instance.

This is the package I'm referring to:

So basically, I would want to add some function called getCampagnes - but where would I do that? I can't just add the function inside the existing package, case that would cause problems later on.

That function would look like this I think:

public function getCampagnes($count,$type) {
      $campagnes = $this->callApi('get','campagnes', [
        'count' => $count,
        'type' => $type
      return $campagnes;

I appreciate the help!