Member Since 6 Years Ago

Experience Points

3,635 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
Best Reply Awards
Best Reply
  • start your 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-in-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 Created with Sketch.


    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.


    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 3
11,365 XP
2 weeks ago
Activity icon

Replied to Laravel Cypress And Colorbox Problem With Authenrication

Hi - thank you. I've just tried that and set iframeLfalse and the behaviour now works as expected. Thanks again

Activity icon

Started a new Conversation Laravel Cypress And Colorbox Problem With Authenrication

Hi Gradually getting my tests to work with cypress but having another struggle today.

On a page I have a button which opens a form within a jquery colorbox. The form is within a page and opened by passing a url to colorbox.

                href: this.options.serverURL

and my test is:

before(() => {
        cy.log('create a new admin user')
            email: '[email protected]',
            password: 'example'

            email: '[email protected]'


    beforeEach(() => {
        Cypress.Cookies.preserveOnce('session_id', 'remember_token', 'spadscms_session');


it('signed in user can create production', () => {

        cy.visit('/productions/create', {
            failOnStatusCode: false


        // cy.get('.col-md-offset-3 > .btn-primary').click();

In my testing app and live server this form opens exactly as expected however in Cypress when I click the button to open the form it redirects to the login page (within the colorbox). For some reason it doesn't recognise the user is already logged in.

I'm not sure how I can resolve this and ensure that the authentication is persisted within the colorbox window

3 weeks ago
Activity icon

Replied to Cypress & Laravel - Persist User Login


Thanks for the reply. I started going down this route because I couldn't get the login method to work on multiple tests, it kept failing.

I posted a question on this here: https://laracasts.com/discuss/channels/testing/cypress-cannot-read-property-add-of-undefined

I tried so many different ways to get this to work but it just wouldn't work over multiple tests so thought I'd go down the persist route

3 weeks ago
Activity icon

Started a new Conversation Cypress & Laravel - Persist User Login

Further journey on cypress

To avoid having to login a user each time on my tests I've been looking at ways of persisting the login session.

Found this guidance on the docs:


What I can't seem to find is the name of the laravel session that I should preserve. How can I find out the name of the session that confirms whether a user is logged in to add it to my exception list?

Thank you

4 weeks ago
Activity icon

Started a new Conversation Cypress - Cannot Read Property 'add' Of Undefined

Hi I'm new to testing with Cypress and wading my way through but have come across an error I can't seem to resolve.

In my tests I'm using Laravel/Cypress package and added some additional functionality that works. However I can't seem to get a run of tests to work properly.

Here's the js relating to my additional helper methods:

 * Create a new user and log them in.
 * @param {Object} attributes
 * @example cy.login();
 *          cy.login({ name: 'JohnDoe' });
Cypress.Commands.add('loginUser', (attributes = {}) => {
    return cy.csrfToken()
        .then(token => {
            return cy.request({
                method: 'POST',
                url: '/development/__cypress__/loginuser',
                body: { attributes, _token: token },
                log: true
        .then(({body}) => {
                name: 'login',
                message: attributes,
                consoleProps: () => ({ user: body })
        }).its('body', {log: true});

And here's the test script:

describe('test login', () => {

    before(() => {
        cy.create('App\Models\User', {
            email: "[email protected]"

    // beforeEach(() => {
    //     cy.loginUser({
    //         email: '[email protected]'
    //     });
    // });

    it('user can see productions index', () => {
            email: '[email protected]'
            .contains('spadsCMS Productions');


    it('user can see productions create form', () => {
            email: '[email protected]'
        cy.contains('spadsCMS Create production');

    // it('user can see productions edit form', () => {
    //     cy.create('App\Models\Production', {title:'Test Production'}).then(body => {
    //         console.log("production:", body);
    //         cy.loginUser({
    //             email: '[email protected]'
    //         }).visit('/productions/' + production.id + '/edit')
    //         cy.contains('Test Production');
    //     });
    // });

    // it('signed in user can see dashboard', () => {
    //     cy.loginUser({
    //         email: '[email protected]'
    //     }).visit('/dashboard', {
    //         failOnStatusCode: false
    //     }).contains('spadsCMS Launch Pad');
    // });

I've commented out the last 3 tests while I get the first couple working.

As it stands the first test - view index - works, this uses the `loginUser' method.

However the second test fails with the error Cannot read property add` of undefined.

It seems it doesn't want to recognise the loginUser method second time around.

If I remove that method call the test continues but as the user is not logged in it fails.

I've tried logging out the use in the previous test at the end but then that throws the same error on the first test instead, then proceeds to login the user correctly on the second test.

I'm sure I'm getting something basic wrong here.

How can I get a user to be logged in and persist over a series of tests within this script?

I just don't know what's causing this error

Any help appreciated

1 month ago
Activity icon

Replied to Cypress And Laravel - Testing Principles Questions

Hi - that's great, thank you. I had looked at the package but didn't get it to work first time - bit of perseverance using the techniques you pointed to has got it working - thank you :)

1 month ago
Activity icon

Started a new Conversation Cypress And Laravel - Testing Principles Questions

Hi I've just started looking at using cypress to test my front end and whilst I get most of it I'm trying to get my head around the best approaches to handle access to the secure pages of the site where a user needs to be logged in.

I've pulled in laracasts package for Cypress and understand the concept of using the login function which creates a new user and logs them in.

In my site users have roles (via related model) and to avoid the site breaking I need to ensure the created user has been assigned the roles needed (for example menu's specific to the role etc).

So what's a suitable approach?

Should I seed the database with my user first and then go to login and then visit the page? The downside to this is I'd need to do this for each test which appears adding in extra steps.

Or is there a better method to create the user (with roles) once and have that user logged in without going to the log in form?

Any advice appreciated

Thank you

4 months ago
Activity icon

Replied to Testing Job Passes But Via Controller Fails

Doh! So I stumbled across the solution - of sorts but not sure if this is expected behaviour.

Through the changes Queue:work was still running. I terminated that and restarted the queue and the changes worked and code worked as expected.

Lesson learned but is that expected behaviour of a queue worker to ignore changes to a class or at least not refresh the class?

Activity icon

Started a new Conversation Testing Job Passes But Via Controller Fails


I'm trying to create a job for a method that creates and emails a PDF. I had the code working through the controller method and now want to move that to a job.

I've created a job class and updated my controller as follows:

##Job class##


namespace App\Jobs;

use App\Libraries\Helpers\PDFGenerator;
use App\Libraries\Repositories\LeagueRepository;
use App\Mail\MailEclecticUpdate;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;

class ProcessSendEclecticUpdate implements ShouldQueue
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

     * @var LeagueRepository
    private $leagueRepository;
    private $league_id;
     * @var PDFGenerator
    private $PDFGenerator;

     * Create a new job instance.
     * @param LeagueRepository $leagueRepository
     * @param PDFGenerator $PDFGenerator
     * @param $league_id
    public function __construct($league_id)
        $this->league_id = $league_id;


     * Execute the job.
     * @param LeagueRepository $leagueRepository
     * @param PDFGenerator $PDFGenerator
     * @return void
     * @throws \Exception
    public function handle(LeagueRepository $leagueRepository, PDFGenerator $PDFGenerator)

        $league = $leagueRepository->find($this->league_id);

        if (empty($league)) {
            throw new \Exception("Error Processing the job", 1);
        $pdf = $PDFGenerator->createLeaguePDF($league);

        $league->player()->get()->each(function ($player) use ($league) {
            if ($player->contactEmail) {
                    ->send(new MailEclecticUpdate(


and the controller method:

     * @param $id
     * @return \Illuminate\Http\JsonResponse
    public function sendEclecticLeague($id)

        return response()->json([


When I run a test on the class using this test - it appears to be working:

     * @test
     * @covers ProcessSendEclecticUpdate::handle
     * @description:
    public function testHandle()
        $league = League::find(27);
        $players = $league->player()->whereNotNull('contactEmail')->get();

//        Bus::fake();


//        Bus::assertDispatched(ProcessSendEclecticUpdate::class);

        Mail::assertSent(MailEclecticUpdate::class, $players->count());


I can see that emails are sent, the PDF generated etc

But when I try and fire the job through the controller method it fails every time with the error undefined variable $data within the PdfGenerator class

Here's that class:

public function createLeaguePDF(League $league)
        if($league->league_type == 'eclectic') {
            $eclecticLeague = $this->eclecticLeague->getLeagueTable($league);

            $courseHoles = $this->eclecticLeague->getEclecticCourseHoles();

            $data = compact('league', 'eclecticLeague', 'courseHoles');

        if($league->league_type == 'matchplay') {
            $fixtureMatrix = $this->fixtureMatrixGenerator->fixtureMatrix($league);
//            fetch details for leagueTable
            $leagueTable = $this->leagueRepository->leagueTable($league->id);

            $data = compact('league', 'fixtureMatrix', 'leagueTable');

        return PDF::loadView('leagues.' . $league->league_type . '.pdf', $data)
            ->setOptions(['fontSubsetting' => true])
            ->setPaper('a4', 'landscape')
            ->save(storage_path('app/pdf/' . $league->league_type . '_league_update.pdf'));


I can see why it fails in that $data will not be set if neither of the conditions are met (and will fix that) but given the testing data$data will get set as I'm passing a valid $league which should have thrown a not found exception from within the job class. I've tried putting in code breaks using PhpStorm to test but as it's in a queue I can't seem to debug properly

So, how can I correctly debug a job?

When I try and put a dd method in it seems to ignore it, in fact any code changes appear to be ignored so what;s the best approach to: 1, test a jobs functionality 2, debug a job