ronon

ronon

Member Since 3 Years Ago

Experience Points
30,280
Total
Experience

4,720 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
233
Lessons
Completed
Best Reply Awards
3
Best Reply
Awards
  • 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.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    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 7
30,280 XP
Oct
06
3 weeks ago
Activity icon

Awarded Best Reply on Vue Remove Prefetch With Laravel Mix And Get A Cdn Like Script?

It seems vue does this automatically if you use the cdn version. So no need to do it own my own

Activity icon

Replied to Vue Remove Prefetch With Laravel Mix And Get A Cdn Like Script?

It seems vue does this automatically if you use the cdn version. So no need to do it own my own

Oct
05
3 weeks ago
Activity icon

Replied to Vue Remove Prefetch With Laravel Mix And Get A Cdn Like Script?

@bobbybouwmann Thought so too, but wasn't quite sure. Do you know how to do this with laravel-mix?

The vuejs docs says to include this code in webpack:

module.exports = {
  chainWebpack: config => {
    // remove the prefetch plugin
    config.plugins.delete('prefetch')

    // or:
    // modify its options:
    config.plugin('prefetch').tap(options => {
      options[0].fileBlacklist = options[0].fileBlacklist || []
      options[0].fileBlacklist.push(/myasyncRoute(.)+?\.js$/)
      return options
    })
  }
}

How would that translate to laravel-mix?

Oct
04
3 weeks ago
Activity icon

Started a new Conversation Vue Remove Prefetch With Laravel Mix And Get A Cdn Like Script?

I noticed that I can split my vue application in chunks and load the chunks if needed. So far I got it that npm extracts the parts in their own files and the site works as expected.

My code for the split: (Afaik this is the correct way!?)

const Account = () => import(/* webpackChunkName: "js/account" */ './components/Account.vue')

new Vue({
    components: {
        'my-account': Account
    },
})

Next I inspected the network tools of my browser and saw that the chunks are loaded everywhere.

After some research it seems that i have to remove the prefetch plugin from vue? Like described here https://cli.vuejs.org/guide/html-and-static-assets.html#preload

I'm currently using the cdn version of vue. So how would I remove the prefetch plugin in laravel mix. I would like to have a seperate file for vue like the cdn version. Is this even possible?

Sep
23
1 month ago
Activity icon

Started a new Conversation How To Use Vuetify A-la-carte?

I only use a couple of components from vuetify in my project and I want to extract those. I read the documentation https://vuetifyjs.com/en/customization/a-la-carte/ but I'm confused what I exactly have to do.

I created a seperate folder to achieve this, since i want a version like the cdn version. I want to seperate my code and the vuetify lib.

As far as I understand it, i cannot use vuetify-loader in this case since it has to be used in an actual project, correct? So I have to manually specify the components i want?

So what do I need to do? I assume sth like this:

mkdir extracted-components
cd extracted-components

npm init

npm install webpack
npm install vuetify 

but how to proceed?

My index.js


import Vuetify, {
    VCard,
    VRating,
    VToolbar,
} from 'vuetify/lib'
import { Ripple } from 'vuetify/lib/directives'


const opts = {
    components: {
        VCard,
        VRating,
        VToolbar,
    },
    directives: {
        Ripple,
    },
}

export default new Vuetify(opts)

My package.json

{
  "name": "vuetest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "webpack"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "vue": "^2.6.12",
    "vuetify": "^2.3.10",
    "webpack": "^4.44.2"
  },
  "devDependencies": {
    "deepmerge": "^4.2.2",
    "fibers": "^5.0.0",
    "sass": "^1.26.11",
    "sass-loader": "^10.0.2",
    "webpack-cli": "^3.3.12"
  }
}

Sep
17
1 month ago
Activity icon

Awarded Best Reply on Too Many Open Files In Composer And Phpunit

I finally found the solution. Thanks to https://stackoverflow.com/a/61637318/5717102 I was able to track it down to the a factory state that was causing the issue.

I defined a state according to the docs like this.

$factory->state(\App\Models\Report::class, 'report', [
    'reportable_type' => 'comment',
    'reportable_id' => create(\App\Models\Comment::class)->id,
]);

After I changed it to

$factory->state(\App\Models\Report::class, 'comment', function ($faker) {
    return [
        'reportable_type' => 'comment',
        'reportable_id' => create(\App\Models\Comment::class)->id,
    ];
});

the error has gone.

I don't have a clue why I have to pass a closure instead of the array, maybe someone can clarify about it

Activity icon

Replied to Too Many Open Files In Composer And Phpunit

I finally found the solution. Thanks to https://stackoverflow.com/a/61637318/5717102 I was able to track it down to the a factory state that was causing the issue.

I defined a state according to the docs like this.

$factory->state(\App\Models\Report::class, 'report', [
    'reportable_type' => 'comment',
    'reportable_id' => create(\App\Models\Comment::class)->id,
]);

After I changed it to

$factory->state(\App\Models\Report::class, 'comment', function ($faker) {
    return [
        'reportable_type' => 'comment',
        'reportable_id' => create(\App\Models\Comment::class)->id,
    ];
});

the error has gone.

I don't have a clue why I have to pass a closure instead of the array, maybe someone can clarify about it

Activity icon

Started a new Conversation Too Many Open Files In Composer And Phpunit

Yesterday i wanted to write a new test for different cases. I created three new factories and created a new Feature test. In that test i wrote a single test and it worked, then i wrote another test and since then I receive this error anytime if I try to execute a test in that project.

PHP Warning:  Uncaught ErrorException: require(/Users/*/PhpstormProjects/project/database/factories/XyzFactory.php): failed to open stream: Too many open files in /Users/*/PhpstormProjects/project/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php:275

I then increased the open files limit on my mac with ulimit -n from 256 to 2048. Now I received a memory allocation error and increased the memory limit to 2gb . Next try i receive the Too many open files error so I increased the limit to ulimit -n 50000 but that doesnt help.

I now also receive that issue when I try to run composer update and it runs php artisan ide-helper:generate in the postupdate part

"scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ],
        "post-update-cmd": [
            "Illuminate\Foundation\ComposerScripts::postUpdate",
            "[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:generate",
            "[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:meta"
        ]
    },

Does anyone has an idea what is going on?

Aug
21
2 months ago
Activity icon

Replied to Eloquent Get All Items Where The Relation Matches Alle Ids

@bobbybouwmann the data is correct. I assume it's since every genre has it's own entry in the genres table and it's own entry in the genre_taggables table. So the AND cannot work since it's checking against data in the same row not in the same table. So I guess I need a query which somehow checks against multiple rows

The query currently looks like this:

SELECT
	*
FROM
	`movies`
WHERE
	EXISTS (
		SELECT
			*
		FROM
			`genres`
			INNER JOIN `genre_taggables` ON `genres`.`genre_id` = `genre_taggables`.`genre_taggable_id`
		WHERE
			`movies`.`movie_id` = `genre_taggables`.`genre_id`
			AND `genres`.`genre_id` in(?, ?))
	ORDER BY
		`title` DESC
Aug
19
2 months ago
Activity icon

Started a new Conversation Eloquent Get All Items Where The Relation Matches Alle Ids

I have three tables: movies, genres and genre_taggable.

A movie can have one or many genres:

public function genres()
    {
        return $this->morphToMany(Genre::class, 'genre_taggable', 'genre_taggables', 'genre_id', 'genre_taggable_id');
    }

I defined a scope where a user can select multiple genres and get all movies which have one of the selected genres.

public function scopeGenres($query, $genres)
    {
        return $query->whereHas('genres', function($q) use ($genres){
            $q->whereIn('genres.genre_id', $genres);
        });
    }

Now I wanted to extend the functionality and add the option to show only the movies which have exactly the selected genres, so I thought I just need to concat the genre ids with an AND, like

return $query->whereHas('genres', function($q) use ($genres){
                foreach ($genres as $genre) {
                    $q->where('genres.genre_id', $genre);
                }
            });

but this doesn't work. I guess that i'm missing something but what? Appreciate any help

Jun
10
4 months ago
Activity icon

Replied to Whoops Looks Weird

Thanks, removing ignition solved the issue and whoops is shown.

I'm a bit confused where this came from, since i havn't installed that und laravel ships with whoops as default "filp/whoops": "^2.4",

Jun
09
4 months ago
Activity icon

Started a new Conversation Whoops Looks Weird

I just created a fresh laravel 7 project. And the first thing I noticed:

Whoops looks very weird.

Thats how it currently looks: https://www.directupload.net/file/d/5845/q5om64as_png.htm

What is that, how get I whoops back?