Member Since 5 Years Ago

Experience Points

4,595 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 27
130,405 XP
13 hours ago
Activity icon

Replied to Create L8 API - Not An SPA, No Passport Needed, Plain Old API

Yep I learnt that the hard way now. The Sanctum documentation talks about token based authentication but it quickly delves into creating tokens and showing them to the user and so on which is overkill for what I wanted to do. It seems that we are being directed towards creating SPA's or refreshing tokens and so on.

All I wanted to do was a simple API. What's gone away are the two places in the manual that explains how to do it the old way.

Activity icon

Replied to Create L8 API - Not An SPA, No Passport Needed, Plain Old API

Thanks @bobbybouwmann I managed to get it working in the traditional way.

What's a bit blind is that entire old school way of doing it has been removed from the manual and doing it the Sanctum way seems impossible for simple APIs.

1 day ago
Activity icon

Started a new Conversation Create L8 API - Not An SPA, No Passport Needed, Plain Old API

I'm struggling to create an API with Laravel since Sanctum. I first want to mention my really simple requirements:

  1. I'm not creating an SPA.
  2. I'm not using Vuejs.
  3. I don't want or need Passport. The overhead of OAth is not needed.
  4. I don't want cookie based authentication
  5. I simply want API tokens.
  6. I will make add-hoc requests from the internet, for example, I might be using Postman for testing.
  7. I don't session authentication, just "a simple API request and response".

In older versions (5.8 + 6.0 for example) I could simply create an api_token field on the users table and get cracking.

Not so much anymore. Now it seems Sanctum is the tool and the documentation quickly leads you into lots of complexity. What am I missing? Prior attempts at doing this worked fine for localhost but the moment I moved to Postman and the internet I had all kinds of authorization issues because it seems Laravel 8 is now expected lots of extra that I don't know what to add.

1 month ago
Activity icon

Replied to Can One Use Both Tailwind And Bootstrap 4 At The Same Time?

@phrane :

  1. What challenges do you have using both?
  2. Your link had a typo extra bracket, there is the correct link thanks for that.
2 months ago
Activity icon

Started a new Conversation Automated Deployment Of Github Repo On Forge Errs With "Untracked Working Tree File" For Phpinfo() Index File

I trying to create an automatic Forge deployment script which does the following:

  1. Contacts remote DNS name server to add an A record.
  2. Calls Forge's createSite
  3. Calls Forge's createMysqlUser
  4. Call's Forge's installGitRepository
  5. Updates the environment
  6. Updates the deployment script
  7. Deploys the site
  8. Installs Let's Encrypt

I'm using because it's got useful timeout and wait functions.

At point 4 installing Git repository it fails, after about 2 minutes (which is also my timeout).

None of the scripts needed either wait or timeouts but the Git one is proving really problematic.

The error appears to indicate an issue with the default index.php file that is created with every new forge site:

Cloning into 'test113.domain'...
Warning: Permanently added the RSA host key for IP address 'a.b.c.d' to the list of known hosts.
error: Untracked working tree file 'public/index.php' would be overwritten by merge.
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Strangely from my localhost to the Forge server this doesn't fail, but from the Forge server to the Forge server I get this issue.

Here is the line that fails:

$result = $this->api->setTimeout(120)->installGitRepositoryOnSite($this->client['server_id'], $siteId, json_decode($payload, 1), true);

If I could get rid of the default phpinfo index.php file that could possibly help?

Any clues how to do this? Or advice on automated Github deployment using Forge?

3 months ago
Activity icon

Replied to Determine DB_HOST By Reverse Engineering Eloquent Mysql Connection

Hi @michaloravec thank you so much, that worked a charm. Sorry for the late reply, I had to wait until today for production deployment, but that works perfectly! Also return (new static) that's really cool, I have to get my head around it.

3 months ago
Activity icon

Started a new Conversation Forge API Refusing To Deploy With 'forge' User And Vague Validation Error

I would like to deploy Forge sites using the built-in 'forge' user. This is the default Unix user that is chosen if you deploy a site and you don't make it isolated. I'm happy with this scenario because it allows me to quickly SSH to the box and do any granular SSH work that might be required. I can also jump between directories without having to go up and down too much.

The Forge API script payload looks like this:

            "domain": "$fullyQualifiedDomainName",
            "project_type": "php",            
            "directory": "/public",           
            "isolated": true,
            "username": "$domain",
            "database": "$database"

That works. Now simply changing from isolated to false and using the built-in user forge, I get a generic validation error.

            "domain": "$fullyQualifiedDomainName",
            "project_type": "php",            
            "directory": "/public",           
            "isolated": false,
            "username": "forge",
            "database": "$database"

Is there a way to determine what is wrong with the validation? Perhaps it's not possible to use the built-in forge user and simulate what's already possible using the UI?

3 months ago
Activity icon

Replied to PHP Append Fluent Method To Custom Repo's Static Method Call In Laravel Nova

After thinking about this for weeks, I just tried:

 public function fields(Request $request)
        return [




Without doing anything in the NovaRepo static method, and it just works! In other words, I didn't have to create an empty return $this or reproduce the name of the method in my static method.

I guess I was put off by PhpStorm saying 'Method 'hideFromIndex' not found in $this` and the fact that autocomplete wasn't working. I'm still not 100% why it's working but it appears the problem was incredibly easy to solve.

3 months ago
Activity icon

Started a new Conversation Is There A Way To Exclude An Extra `node_modules` Directory From Mix?

I am using a stock npm run watch command in the root directory of my project.

Further down the directory hierarchy in resources/js I have installed Storybook, which is a Javascript component development tool. This tool created an additional node_modules folder. The tool is working perfect that I can see by way of yarn storybook.

But now npm run watch is failing because it detects problems in that part of my directory structure that I'm not interested in watching. So I would like to exclude resources/js/storybook entirely.

I googled a lot a and I note an NPM exclude directive but I have no idea of this I what I'm supposed to use, but more importantly if it could work, where to put it. My best guess is webpack.mix.js but this file is really minimalist and I tried a couple of ways but no luck.

This is what I tried:

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css');


  module: {    
    rules: [    
        exclude: [
          path.resolve(__dirname, "resources/js/storybook")

				throw err;
3 months ago
Activity icon

Replied to Laravel Storage - File Exists

@archstanton after having tested this extensively I propose you accept @cronix 's answer.

3 months ago
Activity icon

Replied to Laravel + Vue.js MPA/SPA Hybrid Structure Suggestions And Thoughts.

I am very interested in this topic. To cut to the chase, I want to know if it's possible to run Laravel web.php routing and a Vuejs router together. The majority of tutorials on the web related to Laravel and Vuejs SPAs has this single line for routing in web.php:

Route::get('/{any}', '[email protected]')->where('any', '.*');

This doesn't work for me because it takes over all routes.

To elaborate on this SPA/MPA dilemma, I will explain the rest of the architecture of my App:

  • It's a shopping cart. Vuejs is perfect for this for many reasons some mentioned below.
  • It has a back office. I'm using Laravel Nova for this. Please note, the back office in this instance is only used by the shop owner, and not shop clients / shoppers.
  • It has a shop user back office. This shop back office is for a shopper who places orders and so that they can see what is going on with their orders.

I have no interest in created an SPA for the shop user back office.

For the shopping cart front-end, Vuejs seems perfect. There are many dynamic parts of interacting with a shop, e.g. search, "add to cart", category selection, stock depletion with UI output, etc. There also is a ton of good, albeit very basic, tutorials on doing shopping carts with Vuejs. Creating this in Vue also means incredible responsiveness and speed and is a lot of fun too.

For the shop owner back office, I have decided to use Nova. The licensing fee is minimal compared to what it would take me to develop such features. It's super powerful and perfect for my shop owner's needs, and very interestingly, written using Vuejs and Laravel combined. It's sort of like an SPA but I haven't quite figured it out.

The the shop user's login and remember password and "view orders" section, I am not interested in creating an SPA. I simply don't have the time for that and everything in Laravel is already suited including Blade. That's after all what all that nice scaffolding is all about.

So am I missing the point here? Are you supposed to choose one or the other? How to fix this router problem? Please give me some direction.

3 months ago
Activity icon

Started a new Conversation VueX Store, A Mixin, Or Vue.prototype For Global Settings In Laravel Vuejs Application

I'm battling to find the best place to store global variables.

The specific ones are for example config('') and config('app.url') which I use in various parts throughout the application.

I'm already using a VueX store which seems like a logical place because it's tightly coupled to the debugger. It has some overhead, but I guess it's a choice.

The Vue.prototype also sounds pretty straightforward as I don't have too many global, but is this okay?

I've given Mixins a thought too - but not entirely sure if visibility will be an issue unless I have a really solid easy to remember naming convention.

I just need some guidance what would be best practice. I love Laravel Nova and tried figuring out how they do it, but it's all abstracted a little bit too much for me to understand.

Also, once I have decided on this final destination, where would I initialize these global variables to keep Ajax calls to the minimum? app.js?

As a side note, one of my design goals is to keep everything as tightly coupled to how NativeScript does it thing.

Activity icon

Started a new Conversation PHP Append Fluent Method To Custom Repo's Static Method Call In Laravel Nova

I'm using a static method in Laravel Nova to abstract a slightly complex currency field.

In the Nova fields method, I use this static call:


Refers to:

use Vyuldashev\NovaMoneyField\Money;

class MyNovaRepo

    public static function Money($field) {
        return Money::make($field, config('nova.currency'))->locale(config('app.locale'))->sortable()->storedInMinorUnits();


This works pretty well but now I want to append some of Laravel Nova's fluent methods, e.g. hideFromIndex()

To be honest I've watched videos on changing a normal object class method into a static method time and time again but I simply don't get it.

For starters I guess I need something like this:

function hideFromIndex() {
    // Do something to ensure the calling context is available
    // Append ->hideFromIndex to the calling context
    return $this;

I just don't get it. Am I supposed to declare a constructor that "converts" my static object into a dynamic object? How?

Then once I've crossed that bridge, how would I get the Nova context available? Add $this in the constructor?

4 months ago
Activity icon

Started a new Conversation Determine DB_HOST By Reverse Engineering Eloquent Mysql Connection

I have an enterprise application that has many mysql connections and branches out to various APIs.

To connect to the various table I use Eloquent models like so:

class SalesOrderPickup extends Model
    protected $connection = 'server04-development';

    protected $table="SalesOrderPickup";

Then in many places calling APIs I just use the model.

However, now it turns out there is a hard to find bug and it appears one of these places might be the wrong DB_HOST.

The application is becoming unwieldy to a degree, so I've decided to add debug statements to outbound connection at critical junctures.

Could anyone tell me based on my $connection how to get to the actual host?

I tried this:

$db_host = SalesOrderPickup::$connection->host;
Log::debug("Tried to look for a sales order at " . $db_host);

but it doesn't work. The error is obvious:

Cannot access protected property App\SalesOrderPickup::$connection
4 months ago
Activity icon

Started a new Conversation 403 Forbidden When Changing App From APP_ENV=local To Production

I'm testing an API using Postman. I am posting with Body form_data and api_token is a parameter.

This works perfect on my Forge server if I change the APP_ENV to local

But of course this is a production server, and every time I change APP_ENV to production I get 403 Forbidden.

I should point out this is a Laravel Forge server. I've turned logging on in the NGINX file, and this is the what is displayed:

x.y.189.140 - - [29/May/2020:23:42:29 +0000] "POST /api/v1/product HTTP/1.1" 403 50 "-" "PostmanRuntime/7.25.0"

This is how I am protecting my routes:

Route::group(['prefix' => 'v1', 'middleware' => 'auth:api'], function () {
    Route::post('/product', 'Api\[email protected]');

Please help.

4 months ago
Activity icon

Started a new Conversation Submit VueJS Form With Child Component Values Post Axios Call

I have a VueJS form with dynamic variables that I want to populate just after an Axios Ajax call that fetches essential parameters from the server. Because the child component is included early on the page, none of the form values are populated as one would expect. They are all blank.

If you block the Axios call from submitting the page, and I submit the Axios call again, the form is populated.

I guess I'm fishing for a way to "force" Vuejs to include the child component just after I've made the Axios call.

Below is a snippet of the form. I use a "ref" tag as shown later to submit the form. The child is dynamically populated after an Axios call.


    <div v-if="$store.state.cartItems.length > 0">

        <form ref="form"
              method="post" :action="gateway.destination">

            <input type="hidden" name="_token" :value="csrf">
            <input type="hidden" name="order_id" ref="order_id">
            <input type="hidden" name="payment_method" ref="payment_method">

                    v-if="payment_method ==='payfast'"

Here is where I submit the form:

// Post email, paymentMethod, and the cart data so that a new order is placed
      '/api/v1/order', data).then(res => {
                    eventListener = false;


                    this.order =;
                    this.gateway =;

                    // Clear the cart
                    window.localStorage.setItem('cartItems', '');
                    window.localStorage.setItem('cartCount', '');
                    // Set order_id hidden value
                    this.$refs.order_id.value =;

                    // Submit the form

                    this.disableSubmitButton = false;

                    return true;

So the problem is this.$refs.form.submit(); submits the form, but all the values are blank.

If I disable submission, and then press submit again, all the values are populated.

So the child component's data isn't included but I would like it to be included.

I'm open to doing this another way as well but struggled to do it via a controller.

5 months ago
Activity icon

Started a new Conversation When You Create An Image For A Product Which Goes First? :-)

Guys I'm torn and I think PHP also got this wrong a long time ago.

When I create an image for a product, do I do:


$this->createImage('image.png', $product);



$this->createImage($product, 'image.png);

Please put me out of my misery. Am I creating an image for a product, or a product image? Which goes first, the variable to where I'm putting or the assigned value?

5 months ago
Activity icon

Replied to Use CSS Style Image Width And Height With Nova

Sweet thanks @bobbybouwmann that worked perfectly. I also changed the CSS afterwards to use em instead of px but that was my design problem, and nothing to do with the original question :-)

Activity icon

Replied to Remembering User For Front-end Authentication Post User Creation From Custom Form

Hi again @snapey , after your question which seemed rather trivial I decided to go back to basics. I created a fresh Laravel project and a UI and migrated and then did a test route.

Auth::loginUsingId(1); works in the fresh project, so I guessed something wrong in my application. Then on closer inspection I noticed that this Auth::loginUsingId is called from an API route, instead of a web route. I moved it out of the API route and into Web route and now it works!

Thank you, I'm thinking your questioning actually made me go back to basics and solve the problem!

Activity icon

Replied to Remembering User For Front-end Authentication Post User Creation From Custom Form

Hi @snapey I'm just referring to the default authentication scaffolding. I am naively expecting after running loginUsingId that the front-end scaffolding would report that the user is logged in.

Activity icon

Started a new Conversation Remembering User For Front-end Authentication Post User Creation From Custom Form

I have a shopping cart page which submits both the shopping cart details and the new user's registration details at the same time.

In my NewOrders controller I create a new user:

$user_id = $this->createUser($form)->id;

I then log on the user:

Auth::loginUsingId($user_id, true);

This seems to work for the back-end, but not the front-end. On the back end I test like so:


The correct ID appears, so I am assuming the back-end is happy.

The problem is the front-end is not authenticated. Normally at the top right, where you can see a user is logged in, it's still asking to Login or Register.

I'm guessing I'm missing some fundamental session creation code and Auth::loginUsingId doesn't just produce this.

Could any give me a clue how can I create a user, then also have this user authenticated in the front-end, all from code instead of having to submit the default login form?

5 months ago
Activity icon

Started a new Conversation Use CSS Style Image Width And Height With Nova

I'm trying to apply a CSS style class to an image preview field in Laravel Nova, but I'm not sure if it's possible. I've tried this:

Text::make('Image Preview 1', function() {
                return "<img src={$this->image_url_1}>";
                    'style' => 'height=20px;width=auto'

and I've tried this:

Text::make('Image Preview 1', function() {
                return "<img src={$this->image_url_1}>";
                ['extraAttributes' => [
                    'style' => 'height=20px;width=auto']

Neither worked. I've scouted the documentation and google and just really struggling to find out if this is possible. Any clues?

6 months ago
Activity icon

Replied to Can One Use Both Tailwind And Bootstrap 4 At The Same Time?

I had a long hard thought about this, and I came to the conclusion it's not possible to run two CSS frameworks at the same time. It doesn't make sense. It's the same as saying one wants to run Laravel and Codeigniter at the same time. It simply doesn't make sense.