Member Since 1 Year Ago

Belton, TX

Owner at Code & Salt

Experience Points 32,950
Experience Level 7

2,050 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 225
Best Reply Awards 16
Best Reply
  • start-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-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-token Created with Sketch.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

23 May
2 months ago

NickVahalik left a reply on "Laravel-Websockets" Driver & Redis - Who Does What?

Just in case anyone else comes across this thread, as @thebigk has mentioned, laravel-websockets does come with the ability to "replace Pusher" out of the box.

Essentially what this means is that laravel-websockets implements the Pusher server-API. Therefore, when you configure Pusher on your local environment, you can just point it at LW and it will work. Based on the code, it does not appear that this uses Redis or it's related Pub/Sub functionality anywhere.

So, no, it doesn't use nor even require Redis for what it does.

24 Dec
7 months ago

NickVahalik left a reply on Laravel Notifications Via Mail Not Sending Email On Shared Hosting Server But Works On Local

I am actually having the same problem. Using sync for the queue driver.

08 Aug
1 year ago

NickVahalik left a reply on Validation Field Wildcard

There is a way to validate arrays, though you might have to modify how those fields ultimately end up getting presented to the validator:

23 Jul
1 year ago

NickVahalik left a reply on How Do I Secure My API Endpoints From Requests Outside Of My App?

@p0t4t0 Yes, they very well could. That's why authentication is important in your application. Authentication is really one of the only tools that someone has at their disposal to protect the application. Again, CORS can help you from having people take your hosted JS and embedding it on a different page, but it would not necessarily stop them from capturing the traffic and implementing it server-side by sending the correct headers.

21 Jul
1 year ago

NickVahalik left a reply on How Do I Secure My API Endpoints From Requests Outside Of My App?

@p0t4t0 Well, CORS a browser feature to help ensure that your API is used only by 3rd party websites of your choosing... but that won't stop anyone from spoofing or trying to abuse your API in other ways.

18 Jul
1 year ago

NickVahalik left a reply on How Do I Secure My API Endpoints From Requests Outside Of My App?

If you are distributing an app, you could create an alternate form of authentication (such as device-auth) which devices auto-enroll with as the come online. This way you at least require that any and all application access are logged with at least some form of metrics tying requests to a particular "device".

Otherwise, you could require a client-side SSL certificate which is required to do create the TLS connection—or encrypt things client-side with a private key but you'd end up making more work for them to try to reverse-engineer what you are doing—not stopping them in their tracks.

No, authentication is really the only way to prevent this kind of stuff. And even then it only ensures that your users use the API—but limiting it to a single "app" is hard. It's much easier to stop casual eaves-droppers than it is to stop an interested user from doing this kind of stuff.

Anyway, to recap:

  1. Do some sort of auto-enrollment with each client anyway, so you can keep track/metrics.
  2. Ship a client-side SSL certificate, which is required to access the API (and cycle these occasionally or with each update).
  3. Encrypt/sign your requests with a key that is generated on the device and then the public key gets sent to the server... and just don't expose the key ever to the user (this might work if your app/mobile/device has security attributes that make this secure.
16 Jul
1 year ago
15 Jul
1 year ago

NickVahalik left a reply on Install Pcntl Ext

You'll need to build from source since MAMP doesn't ship with this extension. Luckily, it's actually not too hard.

  1. Download the PHP source code.
  2. Make sure you've got the MAMP bin directory in your path. You'll need the extra tools it has in order to do this.
  3. Once you've got the source, go into php-src/ext/pcntl and then run the phpize command. Note that you'll also need to have Xcode and related tools installed.
  4. You should then be able to run make && make install. This will build the extension and throw it into your extensions directory.
  5. Now, edit the php.ini and enable the module like you would any of the other extensions.
13 Jul
1 year ago

NickVahalik left a reply on First() Not Returning Model (can't Access Public Functions)

Hm. You'll have to post more code because at this point there really isn't a way to reproduce this.

Although, if you're returning a Builder object, then it almost sounds like ->first() isn't returning what you want it to.

What happens if you call ->get()->first()?

NickVahalik left a reply on First() Not Returning Model (can't Access Public Functions)

What is the actual error you are getting as well?

NickVahalik left a reply on First() Not Returning Model (can't Access Public Functions)

What version of Laravel are you using?

12 Jul
1 year ago

NickVahalik left a reply on Contains Vs Exists

Their functionality is very different. The exists() method returns true/false based on whether or not any values in the DB are returned by the specified query:

if (User::exists()) {  //  only do something if a user exists in the DB

Contains, on the other hand, returns true only if the specific Collection contains a particular item.

   if ($collection->contains('Desk')) { // Do something.

That is, in order to emulate exists() on a collection to see if anything exists at all, you'd end up using $collection->isEmpty() instead.

So while the two can function in roughly the same capacity (you can craft a query which selects a user with a specific ID for instance), contains() will always function with a single element vs. exists() which can test for the presence of any objects meeting a criteria you specify in the SQL query.

NickVahalik left a reply on Communication Between Components.

Have them send messages back and forth, managed by the parent container.

09 Jul
1 year ago

NickVahalik left a reply on Switching To Vuejs As Frontend

Well, if you're just beginning to utilize VueJS components in various places, the default Laravel 5.6 resources/assets/js/bootstrap.js sets things up so that you shouldn't have to do much of anything.

That file actually includes CSRF tokens and injects them into Axios. Furthermore, by default your session authentication information will be included in Ajax calls made to the same domain—so your calls should automatically work.

Now, if you're moving to a VueJS SPA, things would be a bit different, but if it is confusing for now, you could continue to do authentication the way you were doing it before and then just load the SPA after you've logged in.

NickVahalik left a reply on How To Implement An External API Into Laravel

@timokfine Yes, Redis is excellent for that.

NickVahalik left a reply on Redis With Phpredis

Ah, well then if you don't have those classes, you might just pull in the predis package and then register a singleton/facade that connects to your Redis instance and makes it available to the application. You can use the config and code from 5.6 as a guide.

NickVahalik left a reply on Handling Large Files Upload With Laravel

Well, outside of simply ensuring that the web server is actually capable of uploading such large files, you might want to consider utilizing a component that helps with resuming of failed uploads and/or maybe even considering writing a custom endpoint that can process chunking of uploads from a JS file uploader.

08 Jul
1 year ago

NickVahalik left a reply on Handling Large Files Upload With Laravel

Are you uploading through a web page? Or are you watching an S/FTP upload?

07 Jul
1 year ago

NickVahalik left a reply on Refresh Token Confuse When To Use

Refresh tokens are really useful to continue to ensure that the remote user still has access to the resource. It requires that they "check in" occasionally. Think of it like a hotel:

When you go to a hotel, you might stay for 3 weeks, but every you might be required to go to the front desk and have them update your key-card. A week's timeframe is probably plenty long enough for most people, but it requires that you check in occasionally in order to validate that your access privileges are still active. Otherwise, if they didn't check this occasionally, you might attempt to use the key after you've reasonably held onto it and cause an issue.

In some platforms, refresh tokens are required so that you don't simply issue tokens that last forever—but require the check-ins. This also means that tokens that expire can't be re-used by an unintended third-party down the road—because in order to refresh you normally have to have access to another token in order to handle this.

NickVahalik left a reply on Redis With Phpredis

It uses Predis. The RedisServiceManager instantiates RedisManager which, based upon the database.redis.driver value, creates either a PredisConnector or a PhpRedisConnector.

Ultimately, you end up talking to a PredisConnector or PredisClusterConnector instance.

The abstract Connection class which PredisConnection extends implements a __call function which passes on the actual commands directly to the Predis\Client instance within the actual Connector.

So basically, you are talking directly to the Predis\Client when using the facade.

NickVahalik left a reply on Mix Stops Npm Install

Glad to hear it!

05 Jul
1 year ago

NickVahalik left a reply on Http Test Redirecting To \ Instead Of Login

Well, if you are following the redirects then when you process the 302, the location will change accordingly.

What does the login controller look like? Sounds like it's doing exactly what it is supposed to do.

NickVahalik left a reply on 403 Error Message Related To App.js File

A 403 would indicate that it's having an problem authenticating. You aren't using HTTP only cookies for authentication are you?

02 Jul
1 year ago

NickVahalik left a reply on How To Implement An External API Into Laravel

You can write a service provider which you can distribute as a separate package which sets up a Facade. You can then set up the necessary config and artisan vendor:publish commands to make the API more "Laravel friendly".

You can also go a step further and add additional wrappers around it to add a caching layer and/or if you're doing sync you can add additional tables... the whole nine yards.

If you're looking for an example: check out this package where I wrapped the BigCommerce API.

NickVahalik left a reply on Controller Laravel Unsupported Operand Type

It sounds like what you really want is this:

compact('materials', 'classroom', 'teacher_id');

This way you'd get an array keyed by variable names. You're trying to take an array (result of compact('materials')) and "add" to it, two scalars... which won't work and can be accomplished by the above.

NickVahalik left a reply on Setting Public Variables On Request Object

It sounds like your wanting the request to do something it is not meant for.

If you're needing to store some extra data that you want related to the request you could wrap the request in a custom object or add a repository-type object manager and use caches to hold onto those objects which you access repeatedly during a request.

Generally speaking, though, I'd try not to modify the request since it's something that is given to you and if you start modifying it you'd end up potentially causing issues with middleware down the road.

NickVahalik left a reply on Composer Autoloading Into Namespace Prefix Possible?

You can add custom psr-4 namespaces in your composer.json:

    "autoload": {
        "psr-4": {
            "Monolog\": "src/",
            "Vendor\Namespace\": ""

See the related documentation.

01 Jul
1 year ago

NickVahalik left a reply on Mix Stops Npm Install

It very well could be that your hosting server limits the number of processes that you can initialize. This is sometimes just a limitation of shared hosts but can also be a security measure to prevent scripts from spawning multiple copies or from taking up more resources than you can utilize.

I'd contact your hosting provider to verify this limitation and see if there is anything that they can do about it. Chances are, this might simply be a limitation that you'll need to solve elsewhere in your deployment strategy. (i.e. you might need to do this locally and then transmit the compiled components over to your host.)

To check this, log in and run ulimit -a on your shared hosting server. You should see some output which also shows the maximum number of allowed processes:

cpu time               (seconds, -t) unlimited
max user processes              (-u) 50    <-- Right here.
virtual memory          (kbytes, -v) unlimited

NickVahalik left a reply on How To Make Closures Readable?

Well, it looks like for one you're using Eloquent's with method... so why not just make it it's own relation? Then you could just do:

MyModel::withActiveMessages($authId)->with('userone', 'usertwo');

Where messagesBetweenUsers() looks something like this:

public static function messagesBetweenUsers($authId)
    return (new static)::where(function ($q) use ($authId) {
                     $q->where('user_id', $authId)
                                  ->where('deleted_from_sender', 0);
                        ->orWhere(function ($q) use ($authId) {
                                $q->where('user_id', '!=', $authId);
                                $q->where('deleted_from_receiver', 0);
24 Jun
1 year ago

NickVahalik left a reply on Getting A Weird Duplicate Show Up On Paginate

I am not sure. You could try logging the page queries to see what exactly is being queried. It is possible that something else is being added to the query which is causing the discrepancy. Here is how to enable query logging.

NickVahalik left a reply on Getting A Weird Duplicate Show Up On Paginate

Why are you doing the count separately?

NickVahalik left a reply on Question About Pulling Data From The Database Into Html Blades

Add a relationship to the post and then load that in by referencing $post->review. This would be the cleanest way.

23 Jun
1 year ago

NickVahalik left a reply on Async In Php

@larafam @Conrix is right. You'd use Queues for that. But let's say that you're implementing some functionality that takes some tweets, loads the top 5 tweets of those tweeters and then spits them out. It might looks something like:

    -> then(function ($results) {
        $lastFiveTweetsOfEach = [];
        foreach ($results as $result) {
            $lastFiveTweetsOfEach[] = loadLastFiveTweetsFromUser($result->user); // Assuming this returns a Promise itself... 
    // each of these would load asynchronously.
        return Promise.all($lastFiveTweetsOfEach); // Continue once all promises return.
    ->then(function ($results) {
        // You now have all of the tweets loaded.

NickVahalik left a reply on Toogling Classes Better

First off, you can mix both class="" and :class="" on an element. So you don't need those extra classes in your computed methods.

<div @click="toogle(1)" class="rounded text-white m-3 p-2" :class="vdnClass"> VDNs</div>

If you want to make the code a bit smaller you can move each of your functions like skillClass and create a single method:

methods: {
    toggleClass(toggle) {
        return {
            'bg-dark':this.toogled != toggle,
            'bg-primary': this.toogled == toggle

And then your <divs> would look like this:

<div @click="toogle(1)" :class="toggleClass(1)"> VDNs</div>
<div @click="toogle(2)" :class="toggleClass(2)"> Ansagen</div>
<div @click="toogle(3)" :class="toggleClass(3)"> Skills</div>
<div @click="toogle(4)" :class="toggleClass(4)"> Feiertagstabellen</div>

So in summary:

            <div v-if="loaded">
            <nav class="nav rounded nav-pills navbar-dark bg-light text-dark justify-content-around">
            class="nav-item w-25 text-center" 
            v-for="hotline in hotlines">
            :class="{'active font-weight-bold':selected == hotline}">
        <div class="row text-center">   
            <nav v-show="clicked" 
            class="nav rounded nav-pills flex-column navbar-dark w-20 pl-3">
                <div @click="toogle(1)" class="rounded text-white m-3 p-2" :class="toggleClass(1)"> VDNs</div>
                <div @click="toogle(2)" class="rounded text-white m-3 p-2" :class="toggleClass(2)"> Ansagen</div>
                <div @click="toogle(3)" class="rounded text-white m-3 p-2" :class="toggleClass(3)"> Skills</div>
                <div @click="toogle(4)" class="rounded text-white m-3 p-2" :class="toggleClass(4)"> Feiertagstabellen</div>
            <div class="w-75 p-2 m-3 text-left">
                <div v-if="toogled == 1">
                    <datatable :data="vdns" :fields="fieldsExtens"></datatable>
                <div v-if="toogled == 2">
                    <datatable :data="announcements" :fields="fieldsExtens"></datatable>
                <div v-if="toogled == 3">
                    <datatable :data="skills" :fields="fieldsID"></datatable>
                <div v-if="toogled == 4">
                    <datatable :data="holidays" :fields="fieldsID"></datatable>



import datatable from './data-table.vue'

export default {
    components: {
    props: ['project'],
    data: function () {
        return {
            loaded: false,
            clicked: false,
            selected: [],
            hotlines: [],
            vdns: [],
            announcements: [],
            skills: [],
            agents: [],
            holidays: [],
            fieldsID: ['ID','Name'],
            fieldsExtens: ['Extension','Name'],
            toogled: ""

    methods: {
        toggleClass(val) {
            return {
                'bg-dark':this.toogled != val,
                'bg-primary': this.toogled == val
            this.selected = hotline
            this.hideAgent = false
  '/get/session/content', hotline)
            .then(response => {
                this.vdns =;
                this.announcements =;
                this.skills =;
                this.holidays =;
            .then(response => this.clicked = true)
            if(this.toogled != value){
            this.toogled = value
            this.toogled = 0    
    watch: {
        project: function(){
            this.loaded = true
            this.clicked = false
            this.toogled = false
  '/get/session/hotlines', this.project)
            .then(response => this.hotlines =


NickVahalik left a reply on I Have A Error While Making Chat App

Sounds like you need to add task to your data() function in the Component:

data() {
    return {
        // other data
        task: {}
        // rest of your data

NickVahalik left a reply on Ajax Request Speed

Is the actual response taking that much time? When you look at the XHR in your browser, is that the delay or is something else taking place?

NickVahalik left a reply on Async In Php

No matter how you move forward you're going to have to learn to retrain your brain when you think about how Async works.

If you've been doing PHP, then you're likely used to code running in a predictable, sequential manner.

This is not how things work in the async world. Instead, functions can and will execute in whatever order they finish in.

If you're new to Async at all, I'd recommend spending some time reading up on Promises and get your head wrapped around them. I really like this site which provide visualizations for how things work.

Now, at a technical level, I'm no expert in the how of PHP's async stuff. However, it looks like spatie/async uses PHP's process control functions to actually handle the async code snippets. Not sure what React PHP does here.

Ultimately, Promises are still the general way of how most async stuff works. Even ReactPHP's react/promise class is just a port of Promise/A+ from ES6.

Anyway, the general idea is this: Consider what you're needing to do, and what you need in order to accomplish that task, and then write small, chainable blocks of code that take each other has inputs.

22 Jun
1 year ago

NickVahalik left a reply on Accessing Controller Functions From Queue Class

In short, best practice would be that you don't.

What you should do is pull out the logic and code for doing your creation and try to put that logic into a more appropriate place.

You could stick those into the Model themselves (creating one or more static functions on the Model), or if the models are complex, create a ModelManager object which handles things for you. The idea being that you should only have something like this in your controller:


NickVahalik left a reply on Tinymce Not Working

You can just do:

<div v-html="descriptionSnippet"></div>

NickVahalik left a reply on Tinymce Not Working

Don't use a filter. Use a computed value:

computed: {
    descriptionSnippet() {
        return post.description.slice(0,100);

Just note that if you cut off HTML, it could cause your page to display incorrectly. You might want to actually strip the HTML and then run it through the snippet. I think something like this should work:

computed: {
    descriptionSnippet() {
        var div = document.createElement("div");
        div.innerHTML = post.description;
        return div.textContent.slice(0,100);

NickVahalik left a reply on Middleware For Separation Of Content.

Yep. You're wanting what's called a Global Scope.

There are two things you'll need to do:

  1. Write the scope (see the link for how to accomplish this).
  2. Then, you'll want to apply the scope. In the example on the linked page, you'd do this in the boot() method of the Model. I think you can also add a middleware that basically calls User::addGlobalScope(YourScope::class) and it would accomplish the same thing. However, I've not tested it.

NickVahalik left a reply on Tinymce Not Working

Do this instead:

<td v-html="post.description"></td>

This will tell the element to bind the value to the html value of the tag.

20 Jun
1 year ago

NickVahalik left a reply on Tinymce Not Working

@Melodia What does the template look like where you are actually displaying the content? E.g. in a Blade template:

{{ $post->description }} 

Or in a Vue component:

    {{ post.description }}

NickVahalik left a reply on Tinymce Not Working

@Melodia The rest of your post is empty. Can you fix it?

NickVahalik left a reply on Console Message Of Vue.js

Normally you'd just add the --hot flag to your npm script command.

19 Jun
1 year ago

NickVahalik left a reply on Hot Reload Is Not Working In Vue-Cli Fresh Installation

There are certain changes which will require a reload.

If you created something which created an error and then you fixed it, chances are it will require a reload because the original wasn't sent to the browser to begin with—i.e. there was nothing to reload.

NickVahalik left a reply on Bootstrap Container Width - Make Container "wider"

Are you using Laravel Mix with the default project settings?

NickVahalik left a reply on Tinymce Not Working

Are you seeing any errors in your console?

How are you displaying the HTML code in your template? Is it Blade or inside of Vue?

NickVahalik left a reply on ServiceProvider

What exactly is the question?

NickVahalik left a reply on Console Message Of Vue.js

This is something that npm will do if you run it in npm run hot if you're using a Laravel project with the default setup. However, even with vue-cli you'd have this option or any webpack project that you've enabled this on.