bobbybouwmann

bobbybouwmann

Developer at Enrise

Apeldoorn, The Netherlands

Hire Me

Member Since 4 Years Ago

Experience Points 1,204,885
Experience
Level
Lessons Completed 1342
Lessons
Completed
Best Reply Awards 1458
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

17 Dec
1 day ago

bobbybouwmann left a reply on Unlocking Badges Workshop Help Needed

It's a relationship on the user model.

However you should watch the full series to get to know everything you saw in the first free video ;)

13 Dec
5 days ago

bobbybouwmann left a reply on I'm Blind Let Me See (https Recaptcha For Beginners)

Is this a question or a notice?

Anyway, you probably need to configure recaptcha in the admin panel to use the correct url if you switch to https! You have to put in your url there, if that is still http it might not work ;)

12 Dec
6 days ago

bobbybouwmann left a reply on I Can't Figure Out How ResponseFactory::stream() Works

Are you sure Storage::disk('public')->readStream($path); is returning anything for you? This should work as far as I can see!

bobbybouwmann left a reply on Call To Undefined Method Illuminate\Auth\TokenGuard::attempt()

The token guard doens't have an attempt method because the token itself is the authentication method and is used everytime during the request. That is different than session authentication.

If you use the api guard you also need a way to authorize the user itself. Laravel offers passport as a package for you to do this. However you can also build it yourself. Check this for more information: https://laravel.com/docs/5.7/authentication

Another option is this: https://gistlog.co/JacobBennett/090369fbab0b31130b51

I think you want the last option!

04 Dec
2 weeks ago

bobbybouwmann left a reply on Is It Possible To Implement Augmented Reality In Laravel Web App

Well it's a front-end thing right? So you can do what even you want with in your web app :D

27 Nov
3 weeks ago

bobbybouwmann left a reply on Found Module On Youtube

I reported it to Jeffrey ;) He will probably take it down!

bobbybouwmann left a reply on Create Custom Artisan Command

Yeah, you can make a package with a command! Then you should be able to reuse it everywhere. Take a look at this: https://laravel.com/docs/5.7/packages#commands

26 Nov
3 weeks ago

bobbybouwmann left a reply on Get Actual Clinet IP Adress

Like the examples suggest you can get around the CloudFlare network because they also send the origin IP-address. A normal proxy doesn't do that for you, unless you tell them to do so!

So you can read another IP-address from some header from the request if it's available, but by default you can only get the host of the requester. In this case is that your proxy!

bobbybouwmann left a reply on Get Actual Clinet IP Adress

When then are using a proxy or a vpn you can't get the original IP-address, because that's why we have a proxies or a vpn :tada:

When you get a request from a browser you only their current IP-address and not everything else that was before that. The only way to get around this is either controlling the full internet or asking your users not to use a proxy or vpn ;)

23 Nov
3 weeks ago

bobbybouwmann left a reply on Read Json From Data Attribute In Blade Problem

You get this error when one of your variables is an array and you try to output it. For example

{{ ['one', 'two'] }}

Comment out some parts of your template to see where the error is ;)

22 Nov
3 weeks ago

bobbybouwmann left a reply on Closure Based Routes?

@ABDULAZIZ - You can't! Because Laravel is caching the connection between the route and the controller that belongs to it. It can't cache a closure for you, because it's not executed code.

So you either can use callbacks or route caching, not both at the same time!

Documentation: https://laravel.com/docs/5.7/controllers#route-caching

bobbybouwmann left a reply on Using Cboden/ratchet I Got Interface 'Rachet\MessageComponentInterface' Not Found Error

Normally you would indeed register something in Laravel so the class is loaded for Laravel. However in this case this is a stand alone solution without specific Laravel support. So you can either create your own service provider for it register it properly in Laravel or you can use a third-party package that is doing this for you!

Laravel Ratchet Package: https://github.com/Askedio/laravel-ratchet

bobbybouwmann left a reply on Closure Based Routes?

@abdulaziz It's never recommened to use route caching in your local environment! It might give you strange results. Also if you want to cache your routes in the future you should use closure based routes ;)

bobbybouwmann left a reply on Roles Based On AD Group

You need authorization for that. Laravel offers you policies and gates. They are perfect for this!

Documentation: https://laravel.com/docs/5.7/authorization

Jeffrey also made a tutorial about it! You should check that one out as well: https://laracasts.com/series/whip-monstrous-code-into-shape/episodes/7

This should put you in the right direction ;) Let me know if you have more questions or need examples

bobbybouwmann left a reply on Type Error: Argument 1 Passed To Illuminate\Auth\SessionGuard::login() Must Implement Interface Illuminate\Contracts\Auth\Authenticatable, Integer Given

Auth::attempt will already log you in when you pass the validation. So if everything is correct and you call this method you will instantly be logged in. You can see the code here: https://github.com/laravel/framework/blob/5.7/src/Illuminate/Auth/SessionGuard.php#L347

A few lines below you can see that the $this->login call is made!

Now, the reason why you get this error is because you pass the id of the user to the method, but it's actually expecting a User object. So an object that has the interface \Illuminate\Contracts\Auth\Authenticatable. The User model has this interface by default in Laravel.

It's already not right to do login after auth attempt in this case. If you look closely to your code. You use Auth::user() in the login method. This means that you're already logged in otherwise Auth::user() would return null.

Let me know if this is clear for you now!

bobbybouwmann left a reply on I Purchased My Subscription At A Price That Was Not Discounted Because I Failed To Use My Black Friday Coupon.

In the footer at the bottom of the page you can find a "support" button. From there you can contact Jeffrey and he will take care of it ;)

21 Nov
3 weeks ago

bobbybouwmann left a reply on Closure Based Routes?

You can't write this as a non closure based route. A route group is not seen as a closure route!

You can however put everything in one line if you wish

Route::resource('admin/posts','PostController')->middleware('auth');

Note: I'm not sure if the admin/ prefix is going to work here though, haven't tested it! Otherwise you would still need to use the group callback ;)

bobbybouwmann left a reply on How To Use A Unique Id For Each Menu And Highlight By Id Rather Than A Class In Laravel 5.6?

So Cronix typed it all out, but that is exactly what I meant. You can't use the same route and expect a different output. Based on the given value (route name) you always get the same result back. So if you want different results per route in one method you need to provide different parameters.

bobbybouwmann left a reply on Vue V3

Cool

bobbybouwmann left a reply on Indexes For 'Likes' Model?

@thebigk Awesome! Let us know if you have more questions ;)

20 Nov
4 weeks ago

bobbybouwmann left a reply on Sqlsrv DB Driver And Timestamp Fields

\x indicates hexadecimal notation. Have a look at an ASCII table to see what 0x00 and 0x04 represent.

0x00 = NULL

This should help you to convert it: https://stackoverflow.com/questions/14674834/php-convert-string-to-hex-and-hex-to-string

bobbybouwmann left a reply on Unique Record Using Two Columns

I though todo_list_id was your primary key of the table.. Anyway, the reason why your example is working is because you're ignoring the primary key of your table and use a different column for the unique statement.

You can achieve the same with this

Rule::unique('todo_items')->where(function ($query) use ($list_id) {
    return $query->where('todo_list_id', $list_id);
}),

Documentation: https://laravel.com/docs/5.7/validation#rule-unique

bobbybouwmann left a reply on Using Bcrypt() In Testing To Compare Passwords

@CALDICOT - Yeah, never send plain passwords over the internet! Use some hashing that can be done on both client and server. This way it's already more secure! You can even hash it with the JWT token if you like.

bobbybouwmann left a reply on Indexes For 'Likes' Model?

First of all you're using the primary method here. However the incrementing id is already the primary key here, so you don't need another.

So indexes should be used based on your search behaviour. If you're only quering results based the user_id and not on the other field you should only index the user_id column.

In the case of a polymorphic relationship you can even set two different indexes. One to get everything from a certain object. Like retrieving all the likes of post. You don't need the user for that

$table->index([''content_id', 'content_type']);

You can also retrieve all likes from a certain user. In that case you can add an extra key for that

$table->index([''content_id', 'content_type', 'user_id']);

You can put both of them in a migration. It's totally fine to have multiple indexes.

Just one more thing! I see that you write your own migration here. Laravel has some helper methods for generating the correct column structure for polymorphic relationships. You can find that in the documentation:

Documentation: https://laravel.com/docs/5.7/migrations#columns (scroll down to morphs

18 Nov
1 month ago

bobbybouwmann left a reply on How To Use A Unique Id For Each Menu And Highlight By Id Rather Than A Class In Laravel 5.6?

Yes I understand! However you always pass the same value to the method 3 times. So for all three methods it's going to give you the same response!

bobbybouwmann left a reply on Unique Record Using Two Columns

Well it's not working because you need to specify which todo-list can be ignored for being unique. Right now the validation is always failing because it needs to be unique at all times

If you take a close look at the documentation you can see you need to provide an extra parameter with the id of the resource you want to ignore. In your case that is the if the of todo list

Documentation: https://laravel.com/docs/5.7/validation#rule-unique

In your case that might look like this

$request->validate([
    'content' => 'required|unique:todo_items,content,' . $list_id . ',todo_list_id',
]);

As of Laravel 5.4 Rule classes where introducest. They make it more readable to write validation rules. If you have Laravel 5.4 or higher I highly recommend you to use this syntax

$request->validate([
    'content' => [
        'required',
        Rule::unique('todo_items')->ignore($list_id, 'todo_list_id'),
    ],
]);

Let me know if that works for you ;)

bobbybouwmann left a reply on Vue V3

@ohffs Do you have a specific question?

bobbybouwmann left a reply on Rate Limiting For Notifications?

Throttling does not exist for notifications. Since you're the one creating the notification you should either check if you can notify the user or not before sending the notification. Basically you need to build your own throttling for this!

Throttling with queues is possible with Redis because you read the amount of prepared jobs and so on. However with notifications you don't know that, because the medium you're sending over can be different per notification (slack, database, nexmo, etc.).

bobbybouwmann left a reply on How To Use A Unique Id For Each Menu And Highlight By Id Rather Than A Class In Laravel 5.6?

The problem is that they are all having the same result here right? You always pass the same values to the same method which will always return you the same result.

Instead you should pass in one unique parameter. For example the route name. Right now you pass the currentRouteName, but that will always be the same for all method calls.

So instead you need to check if the currentRouteName matches the actual route. In your case that can be reports.alluser or reports.categorystatic.

14 Nov
1 month ago

bobbybouwmann left a reply on Forge Didn't Install Composer Or PHP?

It's probably a bad provision. You should just contact the team behind forge using the contact options. Or you can just provision a new server and see if everything is working fine there ;)

13 Nov
1 month ago

bobbybouwmann left a reply on Laravel 5.6 Report Generating Tools

You should be able to generate reports with the jimmy-js package, because it's Laravel 5.6 compatible. See the composer.json of the project: https://github.com/Jimmy-JS/laravel-report-generator/blob/master/composer.json#L14

Do you get any error installing the package? If so it might be another package that is not working for you!

Alternatively you can use https://packagist.org/packages/samuelterra22/laravel-report-generator

Also building this yourself is not hard at all ;)

11 Nov
1 month ago

bobbybouwmann left a reply on Problemas Con Paginate()

I don't see usuarios being used in any of the controller methods as data for the view. Because of that there is also not pagination right? Or am I missing something?

bobbybouwmann left a reply on What Does HTML Form Validation Is Applied Via CSS’s Two Pseudo-classes, :invalid And :valid. It Applies To <input>, <select>, And <textarea> Elements. Bootstrap Scopes The :invalid And :valid Styles To Parent .was-validated Class, Usually Applied To The <

All the information you need can be found here: https://getbootstrap.com/docs/4.1/components/forms/#how-it-works

However you need to write some javascript to make this work. For example on submit it will check if the field is filled whenever it is required. If not it will give it the :invalid pseudo element.

The best way to implement this is simply copying the the form examples from bootstrap and using that format. I see that you use {!! $input !!} which means the HTML for this comes from somewhere else?

bobbybouwmann left a reply on Add & Populate New UUID Column In Existing Users Table

@elijahpaul Yeah, not all types are supported yet! A raw query always does the job ;) You will also get problems whenever you use enums with doctrine/dbal. In those cases I use database statements as well ;)

10 Nov
1 month ago

bobbybouwmann left a reply on Add & Populate New UUID Column In Existing Users Table

Your approach for filling the data using a migration is fine! So nothing on that!

Back to the error! You get that error because you use DB::table. It's not returning Eloquent objects, but plain stdClass objects. Because of that you can't call the save method on it.

Instead you can do this to get all users

$users = User::all();

Now you can call the save method!

bobbybouwmann left a reply on HasManyThrough And Efficient Filtering On 'Through' Model

Laravel relationships are awesome when you need to show all the related data in one view. Then you don't have to use the wheres and so on. However in your case you try to get a specific set of data. Instead it might be easier to use a raw or join query to get the latest post ids and then retrieve those posts based on the ids. This way your query is much faster!

HasManyThrough is a nice feature, but it also performs multiple queries for you to get the correct results. This is indeed slower when you have a lot of data.

bobbybouwmann left a reply on Country Flag Not Displayed?

I guess it's only used for statistics right now! But you're right, in previous designs the flag was used!

bobbybouwmann left a reply on Blockchain Authentication

You have to build this yourself! Laravel doesn't support this feature at the moment. You can however create your own authentication provider that works with Laravel!

Documentation: https://laravel.com/docs/5.7/authentication#adding-custom-user-providers

bobbybouwmann left a reply on Detect PHP Session End With Vue

When you use axios for example for your requests you can use interceptors to check for any 401 Unauthorized responses. Whenever you get a 401 Unauthorized you should be redirected to the login page. Your setup might look like this

const api = axios.create({
  baseURL: `${config.host}`,
  timeout: 10000,
  headers: {
    'X-Requested-With': 'XMLHttpRequest',
    'Content-Type': 'application/json',
  },
  responseType: 'json'
});

api.interceptors.request.use((config) => {
  config.headers.Authorization = `Bearer ${auth.getToken()}`;

  return config;
}, error => Promise.reject(error));

api.interceptors.response.use(response => response, (error) => {
  const statusCode = error.response.status

  if (statusCode === 401) {
    auth.deleteToken();

    routes.push({ name: 'login' });

    return Promise.reject(error);
  }
});

Well this is the basic gist of it! Note that I'm using the vue-router here as well. So the only thing you need to do is make sure that your api return a response with 401 ;)

09 Nov
1 month ago

bobbybouwmann left a reply on Is It Possible To Use Eloquent Helpers Functions On Variables?

$user_id = Auth::user()->id; Below code is already returning a collection of Pigeons. This basically means that you won't be able to perform any query specific calls on it like the select you try to do.

$ownPigeons = Pigeon::all()->where('user_id', $user_id);

So you have to options here. Either fetch all the data using a where user_id and then apply the like query or fetch the pigeons from your user. Also note that you should be able to perform both where statements! It might not return anything, but it should work!

// The simple way

$query = $request->input('query');
$userId = Auth::user()->id;
$pigeons = Pigeon::where('user_id', $userId)
    ->where('name', 'LIKE' , '%' . $query . '%')
    ->get(); // Now we have a collection of all pigeons

return $pigeons->pluck('name'); // Only return the name of the pigeons (basic collections method).


// The relationship way
$user = Auth()->user();

$query = $request->input('query');
$pigeons = $user->pigeons()->where('name', 'LIKE' , '%' . $query . '%')->get();

return $pigeons->pluck('name');

Note that the relationship way only works when you have defined the relationship.

Collections pluck method: https://laravel.com/docs/5.7/collections#method-pluck

bobbybouwmann left a reply on Trying To Use Moment.js

You get this error because moment is now a variable and not a method anymore! Instead it's better to import moment js on the component itself. This way it will only be loaded where you use it!

For example

// show.vue

<template>

    <div>
        {{ moment.format('Y-m-d') }}
    </div>

</template>

<script>

import moment from 'moment';

export default {

    data () {
        return {
            variable: 'data'
            }
    }

}

</script>

Well you probably get the idea ;)

07 Nov
1 month ago

bobbybouwmann left a reply on The New Design Is FANTASTIC!

Yeah it's amazingly good! Jeffrey has done it again!

bobbybouwmann left a reply on Cannot Do The Refresh And Migrate

You are using Schema::create('posts', function () { });. However you're not creating a new table, but updating the table.

So instead you need to use ::table, just like you do with the down method.

Schema::table('posts', function (Blueprint $table) {
    $table->string('slug')->unique()->after('body');
});
06 Nov
1 month ago

bobbybouwmann left a reply on Issue Installing Cashier

Well the error is pretty clear to me. You have the wrong version of the stripe/stripe-php package currently in your project. So you need to check your composer.json and see what version is being used there.

laravel/cashier requires stripe/stripe-php to be at least v5.0.0 or higher. You probably have an older version in your project!

bobbybouwmann left a reply on List Files In A Directory

Are you sure $files has any values? You can check that by just doing dd($files) before return view(). It will die and dump the given variable. If that is empty, then that is the reason you don't see anything ;)

04 Nov
1 month ago

bobbybouwmann left a reply on How To Set A Redis Connection Fallback The Laravel Way?

@fabioi I see it more a chosen approach. In general when for example your redis is down you have bigger issues! In that case you should be monitoring your redis server ;)

02 Nov
1 month ago

bobbybouwmann left a reply on This Is A Test

Perfect test!