Junior Web Developer at Pneunet & Pieter Smit Media



19 Best Reply Awards

  • Member Since 1 Year Ago
  • 352 Lessons Completed
  • 0 Favorites

21st November, 2017

Hawkleaf left a reply on Video Freezes Until Mouse Moved • 2 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 • 2 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 • 2 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 • 2 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 • 2 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 • 2 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 • 2 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? • 3 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 • 3 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 • 3 months ago

Wrap your page in a div maybe?

4th October, 2017

Hawkleaf left a reply on Downloading An Excel Sheet Over An API • 3 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 • 3 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 • 3 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 • 3 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 • 3 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 • 3 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) • 3 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 • 3 months ago

Is User_id fillable?

Hawkleaf left a reply on Dd Is Not Preformatted • 3 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 • 3 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 • 3 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? • 4 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 • 4 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? • 4 months ago

Take it a step further, use Ziggy!


23rd August, 2017

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

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

22nd August, 2017

Hawkleaf started a new conversation Testing Policies • 5 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 • 5 months ago

thanks @alatui , saved my setup!

17th August, 2017

Hawkleaf left a reply on API Authorization On Models • 5 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 • 5 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? • 5 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? • 5 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 • 5 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 • 5 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 • 5 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... • 5 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 • 5 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? • 5 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 • 5 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? • 5 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? • 5 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. • 6 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. • 6 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.

19th July, 2017

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

No that is a model that has an id of both other models. I don't have a model representing the pivot table. My pivot table is register_users and it has column called credit.

Now let's say it has a record like register_id = 1 user_id = 2 credit = 0

And i have a record in my accreditations table where register_id = 1 user_id = 2

I want to scope my query by the credit value of the pivot table.

Hawkleaf started a new conversation Get Pivot Data From Another Model As Query Scope. • 6 months ago

Hi everyone,

I'm struggling with a bit of an odd query. my models are as follows:


  • belongsToMany Users withPivot 'credit'


  • belongsToMany Registers withPivot 'credit'


  • belongsTo User
  • belongsTo Register

So i can access both ids from the Accreditation model.

I'm trying to make a query scope where only records with credit = 1 will show up. So far i managed to get it to work by making an extra method and filtering by that with Collections, but i'd really like to chain this with other query methods.

I would appreciate any suggestions.

17th July, 2017

Hawkleaf left a reply on Is Spark Is The Best Way To Start A Project? • 6 months ago

Let's not forget to mention the ability to learn from spark, if you need to implement it differently spark is maybe not a good starting point. If you want to find out how you can achieve a good starting point spark might be the resource.

I don't own spark myself but I've heard a lot of talk about the fact that you can learn a lot from just reading through it.

30th June, 2017

Hawkleaf left a reply on Isn't Using Blade Template A Bad Practice? • 6 months ago

Interesting viewpoint.

My personal experience is to base this off of your clients requirements. If they only require a simple web application or a webshop then using blade is fine! It isn't that much slower if it is at all. Basically I make a rest API for my projects if I feel the front-end requires some complex logic.

It is indeed easier to build an API for multiple environments to use at the same time, generally I build an API and use blade for page layout and giving data to my Vue components. Then my vue components interact with the API to prevent page loads and allow for said complex front-end logic.

If you are building a bigger infrastructure containing multiple apps I'd build a main API in laravel and hook em all up with Laravel Passport.

Disclaimer: I don't have that much practical experience with huge setups but I've seen projects where this structure worked perfectly fine.

Ohh and, I love blade either way.

29th June, 2017

Hawkleaf left a reply on Collect.js: Use Laravel Collections API In JavaScript. • 6 months ago

Great work, this makes my life much easier as I'm not really used to manipulating data with javascript.

Now it's not that much of an issue anymore ^^

I'd like to know the answer to @polarcubs question also, it doesn't matter that much but I do think it'd be interesting to know.

Hawkleaf left a reply on Laravel - Changing Object Attributes Not Working • 6 months ago

I assume you're changing the attributes of a model, if you want these changes to persist either pass an array to the update method with the properties you'd like to change or use the save method to persist the changes on the object itself.

if ($item->post_title == '') {
                $post = $this->findPostId($item);
                $item->post_title = $post->post_title;
                $item->url = $post->guid;
                $item->slug = $post->slug;
                $item->setAttribute('post_id', $post->ID);

        //Executes a query to save the changes to the database

The changes won't be reflected if you change them without running save, otherwise eloquent would have to run a query each time a property changes.

28th June, 2017

Hawkleaf left a reply on Looping Through Custom Pagination Result Works Only For First Page Not The Other Page? • 6 months ago

Try using dd() at every line to see where the weird behaviour starts.

Hawkleaf left a reply on Vuejs Textarea Escaping Htmlchars Prefilled With Laravel • 6 months ago

You're setting the value of content by actually passing in the variable in the textarea with blade? I'm not sure if that way of passing through variables might be causing it.

If you are using components try passing it through via properties for more success.

Edit Your Profile

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