Member Since 3 Years Ago

Experience Points

4,550 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 1
450 XP
1 month ago
Activity icon

Started a new Conversation Is It Possible To Combine Extract With Css Preprocessing?

I'm on webpack version 4 and trying to achieve 2 things: 1) separate my packages into main.js, vendor.js, and manifest.js 2) compile my sass and less files correctly into css

When I omit the stylesheets and invoke mix.extract(), it creates those 3 files correctly but POSTCSS complains of having no stylesheets to process. My site doesn't load either. However, when I leave in the calls to .less and .sass, they seem to be regarded as JS files. The webpack boilerplate is inserted there along with a comment indicating compilation was unsuccessful. So, my question is whether it's possible to retain the first 3 files and compile my sass (and split my code via dynamic imports). Below is my webpack.mix.js

var mix = require('laravel-mix'),

fs = require('fs'),

MiniCssExtractPlugin = require('mini-css-extract-plugin'),

getFiles = function (dir) {
    // get all 'files' in this directory
    // filter directories
    return fs.readdirSync(dir).filter(file => {
        return fs.statSync(`${dir}/${file}`).isFile();

mix.sass('resources/assets/sass/app.scss', 'public/css/mobile')
    .less('resources/assets/less/desktop/custom.less', 'public/css/desktop')
    .js('resources/assets/js/mobile/main.js', 'public/js')
    //.js('resources/assets/js/app.js', 'public/js')
        "apexcharts","chartjs", "numeral", "owl.carousel", "socket.io-client", "vue-apexcharts", "vue-croppie", "vue-image-crop-upload", "vue-moment", "vue-router", "vue-router-back-mixin", "vue-social-sharing", "vuex","bootstrap"
        optimization: {
            splitChunks: {
                // chunks: 'all',
                minSize: 2000, // 2kb
                cacheGroups: {
                    default: {
                        minChunks: 2,
                        priority: -20,
                        reuseExistingChunk: true
        plugins: [
            new MiniCssExtractPlugin(),
        module: {
            rules: [
                test: /\.scss$/,
                use: [
                    { loader: 'sass-loader'},
            rules: [
                test: /\.less$/,
                use: [
                      { loader: 'less-loader'},
        postCss: [

if (mix.inProduction()) {
5 months ago
Activity icon

Replied to Is It Possible To Combine WhereHas With 'or' Queries?

Um, not sure you understand. I have a list of possible filters and their query modifications. When a request comes in, I run the queries related to filters present. See


class ProductSearch {

    public $builder;

    private $smartBuild;

    function __construct( Builder $builder) {
        $this->builder = $builder;

    public function applyFilterToQuery(array $filters) {

        $pollutants = ['subcategory', 'subcategory2', 'category'];

        $this->smartBuild = empty(array_diff( array_keys($filters), $pollutants)); // [ui=>9, mm=>4], [mm]

        foreach ($filters as $filterName => $value) {
            // dd($filters, $filterName );

            if (method_exists($this, $filterName) && !empty($value) )

                $this->$filterName( $value);
        return $this;

    public function location( $value) {
        $this->builder = $this->builder

        ->whereHas('store2', function($store) use ($value) {
            $store->where('state', $value);

    public function subcategory( $value) {

        $name = Subcategories::where('id', $value)->pluck('name');

        $this->builder = $this->builder->where('subcat_id', $value);
        if ($name->isNotEmpty() && $this->smartBuild) {

            $names = preg_split('/\W\s+/', $name[0]);

            if (!$names) $names = $name;

            foreach ($names as $value)
                $this->builder = $this->builder->orWhere('name', 'like', "%$value%");

You may observe from the above that making a request for categories searches products matching the category name. However, on attempting to combine that alternate match with legitimate AND queries (in location for instance, the result tends to include matching locations OR matching names. The desired result is ((matching name OR matching category) AND matching location)

I also considered fetching the queries (ANDs and ORs) separately and filtering non unique values off but I'm paginating query results so it's probably gonna turn out messy

Activity icon

Started a new Conversation Is It Possible To Combine WhereHas With 'or' Queries?

I'm trying to implement a filter system where, among other attributes and relationships, items are categorized. I realized searching items by their categories alone returns insufficient results since some items containing the search term were not categorized correctly. So I added an or clause like so

$names = preg_split('/\W\s+/', $name[0]);

            if (!$names) $names = $name;

            foreach ($names as $value)
                $this->builder = $this->builder->orWhere('name', 'like', "%$value%");

The challenge now appears when combining this with other filters using the regular and clause. It grabs those (which I do not want) and adds the or when the condition for that fails, thus polluting the final results with unwanted rows.

I'm currently handling this by checking the presence of the or filters and avoiding them when mixed with other filters, which leaves me with a smart filter and a dumb one that searches only the category list when combined with other filters.

I understand this is more of a SQL than an eloquent problem and would like to know if there's a way to run both queries side by side i.e. filter and result set after running the ors queries