Member Since 5 Years Ago

Experience Points

4,775 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,225 XP
3 weeks 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.

1 month 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?

1 month 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.

1 month 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;
1 month ago
Activity icon

Replied to Laravel Storage - File Exists

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

1 month 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.

1 month 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?

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

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

3 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?

3 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?

3 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?

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

3 months ago
Activity icon

Started a new Conversation Can One Use Both Tailwind And Bootstrap 4 At The Same Time?

I am trying to ease myself into Tailwind. My Laravel UI is currently Vuejs which seems to use Bootstrap 4 CSS as well.

I was hoping that I would load Tailwind and still have Bootstrap operational as I start moving over.

I am aware that there are presets for Tailwind and the UI, but I would prefer to build it up slowly instead of suddenly diving into a new UI that is already completely Tailwind.

I'm having a real challenge getting both to Tailwind and Bootstrap 4 work together. Perhaps they are not supposed to?

So far I have done:

composer require laravel/ui
php artisan ui vue --auth
install npm install tailwindcss

In app.scss

// Fonts
@import url('');

// Variables
@import 'variables';

// Bootstrap
@import '~bootstrap/scss/bootstrap';

// Font Awesome added post installation
@import "node_modules/font-awesome/scss/font-awesome";

@tailwind base;

@tailwind components;

@tailwind utilities;

Here things already go wrong, Font Awesome suddenly can't install.

ERROR in ./resources/sass/app.scss
Module build failed (from ./node_modules/css-loader/index.js):
ModuleNotFoundError: Module not found: Error: Can't resolve '../fonts/fontawesome-webfont.eot' in '/home/eugene/code/shop/resources/sass'

No problem, I comment it out as I'll figure that out later.

//@import "node_modules/font-awesome/scss/font-awesome";

At this point I am lost!

According to the Tailwind documentation I must "Process your CSS with Tailwind" and then the only reference to Laravel is if you're using plain CSS. See below

Laravel Mix

If you're writing your project in plain CSS, use Mix's postCss method to process your CSS and include tailwindcss as a plugin:

Am I supposed to include it? Or not?

When I do include it, and my webpack.mix.js file looks like this:

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

mix.postCss('resources/css/main.css', 'public/css', [

Tailwind classes do not work on the front-end.

I guess if it's completely impossible to use both Bootstrap 4 and Tailwind together, a quick HOWTO on getting Tailwind working will also be fantastic as the proper install manual is confusing me as a Laravel user.

4 months ago
Activity icon

Replied to PhpUnit And Access To External URL

I've stumbled upon this post because I also want to know, with PHPUnit and Laravel testing, is it possible to specify and external URL when testing? I'm specifically referring to the following commands:

$response = $this->getJson($uri)

$response = $this->postJson($uri)

I imagine it's not common practice because I guess you have to mock, it's just my current workflow often starts with a few tests and when I start and before I know the API I like to start in the /tests folder.

I tried external URLs in PHPUnit and Laravel testing, but I get this:

"exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",

Please advise.

4 months ago
Activity icon

Started a new Conversation App.scss Imports Google's Font, But When Internet Down Page 1 Minute Timeout

I have a stock site. At the top line of my app.scss I have an import for Google's font:

// Fonts
@import url('');

My expectation is that the fonts are downloaded to the local machine. However, when the internet goes down the page take a minute to load as it first has to time out.

See here:

Am I doing something wrong?

4 months ago
Activity icon

Replied to JQuery Or $ Is Not Defined Even Though Bootstrap's JS Components Seems To Be Working Ok?

Thanks @helmchen , elegant solution, if I "just remove defer" then Vuejs stops working.

4 months ago
Activity icon

Replied to Encrypting Model Data

Hi @milescato and @martinbean ,

Thank you for this incredible post. I concur with @milescato that to avoid "The payload is invalid" you have to check for empty values. I found this out by just copying / pasting @martinbean 's original example in my Laravel Nova application. The other question I have is why Martin's original example didn't include the return statement? Anyway, for it's working beautifully and I love the elegant way one is able to do these things in Laravel. What a winner!

4 months ago
Activity icon

Started a new Conversation Is It Possible To Bypass "Confirm Action" In Nova

I have a specific application, in this case, "Generate PDF", which is a Nova Action.

I feel after selecting "Generate PDF" from the dropdown, and then also pressing "play button", it's unneeded to confirm action.

Is it possible to bypass confirm action in Nova?