Junior Web Developer at Pneunet & Pieter Smit Media



23 Best Reply Awards

  • Member Since 2 Years Ago
  • 363 Lessons Completed
  • 0 Favorites

24th April, 2018

Hawkleaf left a reply on Series Request: Statamic • 1 month ago

@tykus I've seen the tutorial series and I think it's great. Although I do think that laracasts developers could benefit from this either way.

I'm also curious to Jeffrey's approach to CMS's and how he works with them. I always find that Jeffrey has a different way of explaining that really appeals to me.

23rd April, 2018

Hawkleaf started a new conversation Series Request: Statamic • 1 month ago

Dear Jeffrey/Laracasts community,

Lately I've found myself having to choose between Laravel or a simpler CMS for projects. I find myself reaching for Laravel simply because a CMS like statamic doesn't have any laracasts like quality content.

I'm sure I'm not the only one who'd love to see some statamic video's on Laracasts. Especially since statamic can be quite confusing sometimes (Because it's simpler in some ways).

Wouldn't it be great to have some kind of statamic series on here? As using a CMS is a part of most developers jobs (Even though we don't prefer using them).

20th March, 2018

Hawkleaf left a reply on Destroy • 2 months ago

public function destroy(Product $product)

        return redirect('/products');

12th February, 2018

Hawkleaf left a reply on Laravel Passport, User Credentials Are Incorrect • 3 months ago

Alright, I've found the culprit! I found out that if I used laravel tinker to generate a hash with bcrypt() and changed it in the database manually it would work.

Turns out, I was double hasing the password. The modelfactory would hash it, and then an eloquent mutator would hash it again.

I removed the hash from the modelfactory and it works fine now!

Hawkleaf left a reply on Laravel Passport, User Credentials Are Incorrect • 3 months ago

I tried some more things this morning, I switched to a branche from three months ago to see if it was my codebase bugging me. It's giving me the same results...

I'm really at a loss here, what is between my codebase and my VueJs that could be failing authentication? I've never had this issue with passport, I've had trouble before but I'd expect a 500 error instead of a simple 401...

11th February, 2018

Hawkleaf started a new conversation Laravel Passport, User Credentials Are Incorrect • 3 months ago

I started working on my Vue js app today and noticed that the Laravel Api which I login to suddenly gave me a 401. Figured I'd check the database and everything looks fine, I don't have any code changes that could cause this either.

This is how the post request looks (https://puu.sh/zlE1s/9a3a8f3a74.png)

This worked fine before but now I just get this response, (https://puu.sh/zlE3i/33aa41e1b9.png)

The things I've tried so far (I have no idea where I have to look to fix this, as I didn't change my codebase auth wise):

-Re migrate -Reseed database -Double check if seeded data is actually hashed properly -Creating a user manually through tinker -Creating a new password grant and linking that up -composer dump autoload, all the cache clears I could possibly find

Even my feature tests work... My production API doesn't seem to suffer, I tried it on production branche locally but to no avail.

I have no clue what this can be and it's kinda frustrating, I'm hoping you guys might see something I dont. If you need any code, just lemme know I'll try to respond as soon as possible.

29th January, 2018

Hawkleaf left a reply on Using Bcrypt() In Testing To Compare Passwords • 3 months ago

Thanks a ton @bobbybouwmann , Now I think I understand, my test returns green :)

28th January, 2018

Hawkleaf started a new conversation Using Bcrypt() In Testing To Compare Passwords • 3 months ago

I've made an endpoint in my application dedicated to changing a user's password. It works like expected but when I try to make my test work I run into an issue.

This is my test:

    /** @test*/
    public function an_user_can_change_its_password()
        $data = [
            "password" => "newpassword",
            "password_confirmation" => "newpassword"

        $this->put("/api/users/{$this->user->id}/password", $data)

        $this->assertEquals(User::find($this->user->id)->password, bcrypt("newpassword"));

When I try to run it it fails, it tries to compare 2 hashes that are different... Quite unexpected behaviour. Now I'm thinking that they both use different keys for hashing the strings. That leaves me wondering, how do I test my endpoint?

21st November, 2017

Hawkleaf left a reply on Video Freezes Until Mouse Moved • 6 months ago

I believe Jeffrey way uses VideoJS. Maybe check it's github issue's?

17th November, 2017

Hawkleaf left a reply on Video Freezes Until Mouse Moved • 6 months ago

Is it just on Laracasts or are you having this problem on youtube and the like as well?

15th November, 2017

Hawkleaf left a reply on Route::view Dynamically Not Working • 6 months ago

It is recommended to use controllers and such, they provide much more features.

23rd October, 2017

Hawkleaf left a reply on The Visual Studio Code Thread • 7 months ago

@neovive Wow, thanks for the detailed explanation! I'm definitely going to be checking out vscode now!

Hawkleaf started a new conversation Uploaded Image Is Rotated When Uploaded Via Mobile • 7 months ago

I have this really weird issue where if one of my clients uploads an image from his phone it gets rotated.

I've done some research and stumbled upon a few threads mentioning some data that needs to be read from the image. I currently save the image like this:

public function store(StoreImageRequest $request)
        $image = Image::create([
            'user_id' => auth()->id(),
            'attachable_id' => $request->attachable_id,
            'attachable_type' => $request->attachable_type,
            'path' => $request->file('image')->store('images', 'public'),
            'title' => $request->title,

        return $this->setItem($image)->respond();

What I need to do is check the image to see if that data is available and then rotate it depending on that. Does anyone have any experience with this kind of issue? I can't seem to find a simple solution to this problem myself.

Hawkleaf left a reply on The Visual Studio Code Thread • 7 months ago

@jlrdw lol that's quite the statement. I've been using netbeans for school and I can say for sure that wouldn't be able to associate Vscode with netbeans in any way.

What makes you dislike vscode tho?

Hawkleaf started a new conversation The Visual Studio Code Thread • 7 months ago

I figured someone would have to start talking about this sudden uprising of Visual studio code in the editor world. I've seen some podcasts go towards discussing it and I'd like to see how many people use it on the laracasts forum.

Do you use visual studio code? Why do you use it over any other editor of choice? If you'd have to give some advice to someone wanting to start using it for laravel/vue development, what would you say? (think about user settings and plugins for example)

10th October, 2017

Hawkleaf left a reply on Allow API Read Only From One Address/project? • 7 months ago

I recommend using passport too, I've been using it for my API and it works like a charm. It's a little hard to get into (As easy as @TaylorOtwell makes it look, it's hard to grasp for a beginner)

Have patience and thou shall prevail!

Hawkleaf left a reply on How To Go To A Profile On The List Using Axios With Dynamic IDs • 7 months ago

If you're a beginner I don't recommend using Quasar, I'm using it myself and I find I struggle a lot even after about a year of vue js experience.

I'd advice to build a regular laravel application first, or atleast completely finish the Vuecasts on this website. I guarantee you'll be able to build it if you do all the tutorials available here.

Why are you using quasar in the first place? You want to make an android app?

Hawkleaf left a reply on Template Balde To PDF • 7 months ago

Wrap your page in a div maybe?

4th October, 2017

Hawkleaf left a reply on Downloading An Excel Sheet Over An API • 7 months ago

I just found a nice library that helps with this, you can use downloadjs together with axios to download the file. Thanks for your time @36864

Hawkleaf started a new conversation Downloading An Excel Sheet Over An API • 7 months ago

Hey guys,

I'm currently developing a Quasar application that is connected to my API using passport. My client requested a feature where he wants to download an excel sheet from the server. I set it up so that it responds with response()->download('pathtofile');

However when I hit it I get an exception that route('login') is not defined. (I'm hitting it through an Iframe because I can't simply open it in a new tab)

Can I use axios to hit this endpoint? Or is there another solution?

28th September, 2017

Hawkleaf left a reply on Auth()->id() Doesn't Work; But If I Hardcode It, It Does • 7 months ago

Can you try it like so?

$data['user_id'] = auth()->id();
$data['rest of data'] = '';


Hawkleaf left a reply on Laravel 4.2 Query To Database • 7 months ago

I believe you should use this:

DB::table('target table')->select(DB::raw('insert big query here'))->get();

Hawkleaf left a reply on How I Can Pass Variable On Javascript Html Object • 7 months ago

Everything between the {{}} is PHP, you won't be able to use your javascript variable there. You'd be better off just typing out the route url manually. Unless you have the id javascript variable available in your php, then you could

var $iframe=$('<object data="{{ route('browserview', $id) }}" width="100%" height="600px"></object>'); 

Hawkleaf left a reply on Auth()->id() Doesn't Work; But If I Hardcode It, It Does • 7 months ago

Are you using anything like passport? I used to have this issue as well. I believe I had to specify the auth guard to use. So that'd be 'api' or 'web' I think

Hawkleaf left a reply on Laravel Model Permanently Deleting Model(Events) • 7 months ago

I don't know of any such event, what you could do is run a check on the deleted_at column (there's also a property on the model that should indicate if it is already soft-deleted). Then you can proceed to completely delete the model if you desire.e

Hawkleaf left a reply on Auth()->id() Doesn't Work; But If I Hardcode It, It Does • 7 months ago

Is User_id fillable?

Hawkleaf left a reply on Dd Is Not Preformatted • 7 months ago

Do you have any chrome extensions that might mess with the tags? Also, see if it doesn't work in incognito

25th September, 2017

Hawkleaf left a reply on Laravel Forge: Class Not Found When Hitting An Endpoint • 8 months ago

Turns out it was indeed the typo. Weird that it didn't fail on my mac but failed on the server.

Thanks for your time!

24th September, 2017

Hawkleaf started a new conversation Laravel Forge: Class Not Found When Hitting An Endpoint • 8 months ago

I've recently deployed my API to forge and I'm getting a weird error. On bugsnag I get this error: https://puu.sh/xI0Jn/2192beaaf9.png

I can't make any sense of it, tests that use the class work fine locally. I can use them through my app locally too. I also have the correct configuration for loading the Api folder in my composer.json

It seems to be a production related issue, any ideas?

18th September, 2017

Hawkleaf left a reply on How To Start With Lumen And Vue? • 8 months ago

I feel like your best bet is still using Laravel, I don't know the specifics on what lumen has or not but you're not losing anything by choosing laravel, especially if you're building a traditional web app. If you are building just the API I would totally go for lumen.

You don't have to use vue router, you can just use traditional routing if you don't mind page reloads. I like using both blade and vue components.

VueX? Nah, don't really need it unless your application is going to be huge. If it is going to be huge I would still doubt really needing it.

I wouldn't know the answer to your last question but since it's Lumen specific using Laravel will be your best bet.

2nd September, 2017

Hawkleaf left a reply on Laravel Horizon Not Loading In Production, Showing 'Parse Error' In WaitTimeCalculator.php • 8 months ago

Might be worth checking the horizon github issue list to see if someone else has encountered this aswell, sounds like something you might want to create an issue for.

27th August, 2017

Hawkleaf left a reply on How Do I Use Route() With Vue? • 8 months ago

Take it a step further, use Ziggy!


23rd August, 2017

Hawkleaf left a reply on User Policy On User Model Not Working • 9 months ago

@ganicus Wow, been stuck on this for hours.... Thanks!

22nd August, 2017

Hawkleaf started a new conversation Testing Policies • 9 months ago

I'm currently building my Authorisation layer, I'm done setting up a test for my policy but it doesn't seem to work. I can't find where the issue lies.

First some setup,

I registered my Report model in my authserviceprovider to a ReportPolicy with this code:

    use HandlesAuthorization;

    public function before($user, $ability)
        return $user->hasRole('admin', 'operator');

    public function view(User $user, Report $report)
        return $user->hasPermit('view', $report);

This takes care of authorization for me, I have this concept of permits, I bind a resource to this with a polymorphic relation together with a keyword specifying their 'Action' which is now permitted, in this case viewing the model.

This is my test

    /** @test */
    public function a_user_with_a_permit_can_view_a_report()
        $user = create(User::class);
        $report = create(Report::class);


        $report->addPermit($user, 'view');

        $this->assertTrue($user->can('view', $report));

And unfortunately it is returning false, All my other tests are unharmed, so it's an isolated case.

Any idea's?

21st August, 2017

Hawkleaf left a reply on SQL HY000 Error When Seeding Phpunit Tests • 9 months ago

thanks @alatui , saved my setup!

17th August, 2017

Hawkleaf left a reply on API Authorization On Models • 9 months ago

Ohh wow, everything is starting to fit together, thanks @Erik ! I didn't initially think about gates!

Hawkleaf started a new conversation API Authorization On Models • 9 months ago

Hello everyone,

I've been stubbing my toe during the planning of a feature in my current project.

Basically the project has a few different roles (Defined with spatie's laravel-permissions package).

Operators, Engineers and clients

Operator's can create projects for companies. The idea is that Operators then give project access to engineers, and view-only access to clients.

I have a simple API standing right now that allows me to get all the data I need, and building in role access for CRUD actions should be easy.

I can't seem to figure out how and where I should define access to certain models. With laravel-permissions you can make permissions but they seem to broad, I need to specify a specific model's ID.

As you can see it's all still quite chaotic, do you have any resources/articles or idea's that might enlighten me?


15th August, 2017

Hawkleaf left a reply on What Is A Complex/nasty Queue Related Situation You've Ever Faced? • 9 months ago

Might be silly, but maybe something like performance statistics? This can vary greatly per server but I'd love some indication of when to scale hardware up.

I haven't really had much experience using queue's but I can see myself using performance statistics for scaling my servers.

Hawkleaf left a reply on Deleting Notifications For A Deleted Model? • 9 months ago

I have no idea myself, I'd like to know the answer to this though as this sounds like something that would be pretty crucial.

Hawkleaf left a reply on Auth()->check() Inside Error Template • 9 months ago

Hmm, sounds like the AuthServiceProvider code hasn't run yet. Causing the user not to be logged in, atleast, the application doesn't know yet because it didn't get to check.

Why would you want to run abort in a service provider and then still have your application work?

9th August, 2017

Hawkleaf started a new conversation Vue Router Blank Page Using BeforeEnter • 9 months ago

I'm building an app with quasar and want to check on some routes if the user is logged in or not. If they are not they should be redirected to the login page. If they try to access the login page while logged in they should be redirected to the homepage. Right now it's working when I'm logged out, I visit '/home' and it redirects me. However, when I'm logged in it doesn't seem to work at all! I just get a blank page...

import Load from 'helpers/system/load-component';
import Vue from 'vue';
import VueRouter from 'vue-router';
import Auth from 'helpers/auth/auth';


export default new VueRouter({
  routes: [{
      path: '',
      component: Load.layout('landing/main'),
      beforeEnter: (to, from, next) => {
        if (Auth.check()) {
        } else {
      children: [{
        path: '/',
        name: 'login',
        component: Load.page('auth/create'),
      }, ],
      path: '',
      beforeEnter: (to, from, next) => {
        if (!Auth.check()) {
        } else {
      children: [{
        path: '',
        component: Load.layout('home/main'),
        children: [{
            path: '/home',
            name: 'home',
            component: Load.page('home/index'),
            path: '/audits',
            name: 'audits',
            component: Load.page('audits.index'),
      }, ]


7th August, 2017

Hawkleaf left a reply on Vue SPA Vs MPA/SSR • 9 months ago

I'd definately take @martinbean 's advice into account. If you are indeed in the environment where you could seperate your front and back-end I recommend using Quasar if you need other platforms aswell. Otherwise I'd just stick with one laravel app that uses standard blade views with vue components in them. If you want a SPA kind of feel you could always go with turbolinks.

Hawkleaf started a new conversation SVG's, Matter.js, Vuejs And Some Unexpected Behaviour... • 9 months ago

I'm currently working on a project where I have to create some objects in a 2d physics element to simulate balls falling down. I've got SVG's for the balls themselves and I've got some nice JS classes helping with the logic. However, I'm stuck at loading the SVG's into the DOM.

Check out this SVG: https://paste.laravel.io/bkg8p

If I load it into the browser directly from the .svg file it displays. Weirdly enough it isnt in the top left corner either. I received them from a client who saved them as .ai out of photoshop. I then used a simple converter to get them into SVG format, followed by the svgo converter



When I render them out on the page they are completely invisible, https://puu.sh/x3O9K/6810120c08.png

I load them in like so:

<template lang="html">
  <div id="bingoBalls">
    <img v-for="i in 24" :src="path(i)" :id="i">

export default {
  methods: {
    path(number) {
      return require('../../../../assets/images/balls/' + number + '.svg');

<style lang="stylus">

I'm dying from the inside trying to find out what I'm doing wrong, the SVG's should be fine...

Hawkleaf left a reply on Need Help With Routes • 9 months ago

Is the news stored in the database or in HTML files? If it's stored in HTML files you should go with the approach Stevenson posted.

If you are planning on putting it the database I'd suggest using the built-in pagination features of laravel.


Hawkleaf left a reply on Tutorial Por Spark Vue Forms? • 9 months ago

To be honest I think your best bet is doing the Vue js tutorials right here at Vuecasts.com . He'll talk a lot about vue at first but then starts talking about forms and how to nicely tuck them away.

I just used the tutorials myself last week to get some nice JS classes in there for easy Axios forms!

I don't know about the Spark tie in but it should definitely help you understand.

2nd August, 2017

Hawkleaf left a reply on Eloquent Relations On Models With 2 Databases • 9 months ago

Ehh, I checked my git commits but I an't find anything useful except for the fact that I specified the connections on each model with the $connection property. Even if it is on your default connection, It's the only thing I can think of right now

27th July, 2017

Hawkleaf left a reply on Vee Validate, Why Is My Setup Not Working As Expected? • 9 months ago

Turns out the errors object is not passed with the methods. I ended up using one property that would contain a boolean and just passing through the errors for said input.

This has me typing both errors.has('fieldname') and errors.collect('fieldname') each time although it's the only way it works.

I might just send one prop through with an object of some sorts that contains the data, might be easier.

Hawkleaf started a new conversation Vee Validate, Why Is My Setup Not Working As Expected? • 9 months ago

Hello everyone,

I'm trying to create some abstract components form a Quasar app that I'm making. The form classes are mostly from jeffrey's series. Except I need my app to work offline, hence the reason I'm using Vee Validate and not just simply returning laravel's validation errors.

This is my current setup:

// Create.vue
<template lang="html">
  <div class="card width-2of3">
    <div class="card-content column group">
      <input v-model="form.email"
      <validation-errors field-name="email" :form-errors="errors"></validation-errors>

      <input v-model="form.password"
      <validation-errors field-name="password" :form-errors="errors"></validation-errors>

      <button class="primary" @click="authenticate()">Log In</button>


import auth from 'helpers/auth/auth';
import Form from 'helpers/forms/form';

export default {
  data() {
    return {
      form: new Form({
        email: '',
        password: ''

<style lang="css">

The validation-errors component:

// validationErrors.vue
<template lang="html">
  <div class="form-errors" v-if="formErrors.has(fieldName)">
    <span class="text-red" v-for="error in formErrors.collect(fieldName)"><i>error_outline</i> {{error.msg}} </span>

export default {
  props: ['formErrors', 'fieldName']

<style lang="css">

In theory this should work, I'm properly giving it the errors and showing it based on the errors.

Any idea's? Am I missing something?

Ohh, here's the documentation for VeeValidate:


20th July, 2017

Hawkleaf left a reply on Get Pivot Data From Another Model As Query Scope. • 10 months ago

Ok i figured it out. Here's the solution i found:

I added these relations

class User 
    public function registers_with_credit()
        return $this->belongsToMany(Register::class)
            ->wherePivot('credit' ,1);
class Register 
    public function users_with_credit()
        return $this->belongsToMany(User::class)
            ->wherePivot('credit' ,1);

And then the query scope:

class Accreditation
    public function scopeWithCredit($query)
        return $query

It's weird and very specific but maybe this will save someone a headache at some point.

Hawkleaf left a reply on Get Pivot Data From Another Model As Query Scope. • 10 months ago

This method on the Accreditation model is the closest i've come to what i want:

public function credit()
    return $this->user->registers
        ->where('id', $this->register_id)

But this can't be used as a query scope, only to filter an existing collection. This would work fine but it doesn't allow for pagination, unfortunately.

Edit Your Profile

Want to change your profile photo? We pull from gravatar.com.