Member Since 2 Years Ago

Experience Points

3,150 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.

  • Community Pillar

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

Level 6
26,850 XP
1 week ago
Activity icon

Started a new Conversation Laravel Nova - Inherit Field From Relationship On Creation

Hi there, I have a Laravel Nova resource that inherits a User model as one of its fields:

public function fields(Request $request)
        return [
            ID::make(__('ID'), 'id')->sortable(),
            Text::make('Name', function () {
                return sprintf('%s %s', $this->first_name, $this->last_name);

            Text::make('First Name')
                ->rules('required', 'max:254'),

            Text::make('Last Name')
                ->rules('required', 'max:254'),

			Text::make('Phone Number')

			BelongsTo::make('User', 'users', 'App\Nova\User'),

The problem I'm having is that the Phone Number field should be inherited from the User that I'm relating to the new instance of the model, as it already has a phone number. Is there a way that I can tell Nova to create the instance of this model with the Phone Number from the related User model?

Activity icon

Started a new Conversation Laravel Nova - Make Model Respect Tenant Connection

I"ve got a multi-tenant web application where each tenants has their own users table (which is the model I use to authenticate users). I've implemented Laravel Nova, and I use Spatie's multitenancy packages to allow tenants to access the application using unique URLs (e.g. https://{tenant}.{my_domain}.com).

This works for managing my models, but when I try to create new user instances, it still tried to look for the Users table on my landlord database instead of the current tenant's database, eventhough my User model is using Spatie's UsesTenantConnection trait, it seems to be ignoring that and still looking for it on my landlord database.

How can I make the model look on my tenant's database instead of on the landlord database?

Activity icon

Replied to Cast A Date For Laravel Nova, But Return My Own Format

It displays as an ISO timestamp. I've worked around this by casting at return in my controllers.

Activity icon

Started a new Conversation Cast A Date For Laravel Nova, But Return My Own Format

I have a Model that I want to use in Nova that has some data and datetime fields. Nova keeps complaining that I need to cast it to a Date type in my model, but I want to always return the format of dates as "Y-m-d" and datetimes as "Y-m-d H:i:s". I tried to cast the fields, and then edit the get attribute methods as follows, but the getAttribute methods seem to overwrite the casts:

protected $casts = [
    'date' => 'date',
    'start_time' => 'datetime',
    'end_time' => 'datetime',
    'actual_start_time' => 'datetime',
    'actual_end_time' => 'datetime'


public function getDateAttribute($value)
    return Carbon::parse($value)->format('Y-m-d');

public function getStartTimeAttribute($value) {
    return Carbon::parse($value)->format('Y-m-d H:i:s');

public function getEndTimeAttribute($value)
    return Carbon::parse($value)->format('Y-m-d H:i:s');


How can I cast to a date so Nova will be happy, but also always return in my desired format when returning the model instance to endpoints?

2 weeks ago
Activity icon

Replied to Custom Scoping A Model For A Specific Relationship Entry Based On Passed Value

What if employee will always be non-null, but might not have an invoice object related to it? I.e. I will always populate employee with a value, but if there is no invoice instance with that employee_id, then it should return an empty array in "invoices: []"

Activity icon

Started a new Conversation Custom Scoping A Model For A Specific Relationship Entry Based On Passed Value

I have a Shifts model that can have multiple invoices attached to it, and thus has an "invoices" relationship that returns an array of Invoice objects. Each of these Invoice objects has a employee_id field in it that tells me what employee that invoice is for. What I'm trying to do, is to create a scope that returns the invoice related only to a specific employee based on a value that I pass, so I tried the following:

public function scopeWithEmployeeInvoice($query, $employee) {
        $query->with('invoices')->whereHas('invoices', function($q) use($employee) {
            $q->where('employee_id', '=', $employee->id);

and I call it like this:

$shifts = Shift::all()->withEmployeeInvoice($employee->id);

The problem I'm experiencing is that if there is no invoice for the specific employee passed, it returns a blank as the whereaHas still kicks in and finds nothing. One way I can think of dealing with this is an if statement in the scope method, but is there a more eloquent way of dealing with this?

4 weeks ago
Activity icon

Replied to Pusher Not Connecting With Https

Yes I have. But how do I know what the “right” port setup is? I’m using Let’s Encrypt for Https certificates but I’m not sure what the port should be.

Activity icon

Started a new Conversation Pusher Not Connecting With Https

Hi all

I've been struggling all day to get my Laravel application to connect to Pusher. The logs tell me the following:

[2021-03-13 23:29:35] .ERROR: Failed to connect to Pusher. {"exception":"[object] (Illuminate\Broadcasting\BroadcastException(code: 0): Failed to connect to Pusher.

I've searched and searched but I'm not getting a better understanding of what I should be doing to connect. Here is my current pusher setup in broadcasting.php

'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'scheme' => 'https',
                'encrypted' => true,
                //'port' => 443,
                'host' => '',
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'useTLS' => true,

I host a web application on digital ocean and I'm using Nginx and Let's Encrypt for my certificates. Maybe that is affecting my pusher connection, as I don't know what else could be. I've also since this last worked changed my application to a multi-tenant application, so now I use subdomains to identify tenants (E.g., and I'm also not sure if that is having an impact.

I'm also really curious as to what to set host and port to in the pusher config, as I couldnt' find much information about this.

Further, my pusher account works, my credentials are correct in .env. It is currently connected to more than one app, but also unsure if that is an issue. Whevener I try to dispatch an event that broadcasts, it just said it couldn't connect with any further information.

Also, the frontend can connect to the pusher channel and receive information via the event generator, it's just the backend that won't

Could someone help me out as to where I need to start in fixing this?

1 month ago
Activity icon

Started a new Conversation Running Spatie's MediaLibrary Conversions With Supervisor

Hi all

I have a multi-tenant application where I use supervisor to run some queue workers and also use Spatie's media library extension. I have the MedLibrary extension conifgured to save conversions of files to my public filesystem when a user uploads a file like this:

public function registerMediaConversions(Media $media = null)



This worked fine when I was running it with *php artisan queue:work", but I'm getting failed jobs when running this with supervisor with the following error:

League\Flysystem\FileNotFoundException: File not found at path: 12/20210225_10_53_30pm.jpg in /var/www/my-app/vendor/league/flysystem/src/Filesystem.php:389

From what I can see, supervisor might be looking in the wrong place for these files to convert? How can I correct this?

2 months ago
Activity icon

Started a new Conversation Migration Fails Due To "telescope_entries" Table

Hi all!

I recently installed Spatie's Multi-tenancy package for my Laravel 7 project, and started using a multi-database approach, having a different database for each of the tenant's using my app. This worked up to recently, but when I attempted to do a new migration I got the following error (appeared out of nowhere!):

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'telescope_entries' already exists

I checked and I do have telescope installed on my app, but I don't have anything for it in my migrations folder. Also, there is no telescope_entries table in my tenant database! Thus, I tried to remove telescope by doing the following:

  1. Commented out App\Providers\TelescopeServiceProvider::class, in my app.php
  2. Added the following to my composer.json:
"extra": {
        "laravel": {
            "dont-discover": [

However, I'm still getting the error. So my questions are:

  1. Is there something I need to do to make Telescope adhere to multi-tenancy?
  2. How can I fix this migration error? It feels like the migration is sitting in vendors or something but still being called up eventhough I removed the TelescopeServiceProvider, and I don't know enough yet to sort that out, please help!
2 months ago
Activity icon

Replied to Changing A Migration Table In Production..

Quick question on this. In my migration, I specified

$table->primary(['shift_id', 'occurs_at']);

If I want to change the primary to an auto-incrementing integer, how could I do that?

What I know I can do is make a copy of this table, then create the new table structure with the if column, then copy over the data. But will laravel know to look at the new id field as the real id as I've already run this migration and can't migrate:fresh?

Activity icon

Started a new Conversation Changing A Migration Table In Production..

I have a pivot table in production who's id I want to change. Here is my migration currently:

Schema::create('shift_occurence', function (Blueprint $table) {
    $table->primary(['shift_id', 'occurs_at']);



My system is in prod, and I want to change the primary field for this table to something that considers more than two fields, e.g.:

$table->primary(['shift_id', 'occurs_at', 'start_hours]);

I know how to refactor from a field to a pivot table, but what is the best way to change the actual structure of this table? I'm thinking:

  1. Create and run migration for new table
  2. Copy data over
  3. Delete old table

But the new table needs to have the same name. So how would I handle that?

2 months ago
Activity icon

Started a new Conversation Nexmo Not Picking Up Credentials In .ENV File

I recently added laravel/nexmo-notification-channel to my laravel project which also installed Nexmo/nexmo-laravel.

After installing, I published vendor files so that I get config/nexmo.php and in there I noted that it looks in the .env file for NEXMO_KEY and NEXMO_SECRET.

So I went ahead and created these within my .env file

NEXMO_SECRET=[my secret]
NEXMO_SIGNATURE_SECRET=[my signature secret]

After this, I added Nexmo to my service providers in app.php:

'providers' => [

and also added the following in config/services.php:

'nexmo' => [
    'key' => env('NEXMO_KEY', ''),
    'secret' => env('NEXMO_SECRET', ''),
    'sms_from' => '[my number]'

But I still get the following error when thrying to send an SMS using the use Illuminate\Notifications\Messages\NexmoMessage; class:

"message": "Provide either nexmo.api_secret or nexmo.signature_secret",

I can use these same credentials to send an SMS from CLI, so why can't I send it from laravel?