bobbybouwmann

bobbybouwmann

Developer at Enrise

Member Since 5 Years Ago

Apeldoorn, The Netherlands

Experience Points
1,598,275
Total
Experience

0 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
1587
Lessons
Completed
Best Reply Awards
2051
Best Reply
Awards
  • 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.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    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.

Level 50
1,598,275 XP
Jan
19
22 hours ago
Activity icon

Replied to Email Verification 403 And Rewriterule On .htaccess File

But this sounds more like an issue at your server setup than in the rewrite rule of your .htaccess. How does your local development look like?

Activity icon

Replied to Displaying Things From Foreach Inside Foreach

This is because you always loop over all getAndCheckInvitations for each user. Because of that you always loop over the same data.

Instead, you need to do something like this I guess

@foreach($getRegularUsersScoutAction as $regularUser)
    {{ $regularUser->name }}

    @php
        $regularUserInvitations = $getAndCheckInvitations->filter(function ($invitation) {
            return $invitation['regular_user_id'] === $regularUser->id;
        });
    @endphp
    
    @if (count($regularUserInvitations))
        You already invited this user
    @else
        Give a wave to this user
    @endif

@endforeach

Here is a quick example of how you can do it with double data. Ideally, you want this data to be fetched in your controller and set an extra field on the user model to determine if they are already invited. But that is something you can look into ;)

Activity icon

Awarded Best Reply on API Documentation Generator

I always find this a good package to use: https://github.com/mpociot/laravel-apidoc-generator

To be honest, I rather have this documentation outside the application. Adding all these docblocks just to be able to generate it, makes it tedious process.

Activity icon

Awarded Best Reply on Valet And Connecting To Database.

Laravel Valet assumes that you have a mysql server running yourself locally. You can't connect to the database by default. If you want that you need to install a tool like PHPMyAdmin. In general just putting 127.0.0.1 in the .env for the DB_HOST key should be enough to make your application connect to your local database.

If you need a database, try MySQL by running brew install [email protected] on your command line. Once MySQL has been installed, you may start it using the brew services start [email protected] command. You can then connect to the database at 127.0.0.1 using the root username and an empty string for the password.

Documentation: https://laravel.com/docs/6.x/valet#installation

Activity icon

Awarded Best Reply on Calculate Week Number With Dates

Laravel comes with Carbon by default. This is a very good library that can help you transform dates to other dates.

Here is an example

$date = Carbon::parse('2019-01-19 16:00:00');

$weekOfYear = $date-> weekOfYear;

$startOfWeek = $date->startOfWeek()->toDateString();
$endOfWeek = $date->endOfWeek()->toDateString();

You can find all these methods here: https://carbon.nesbot.com/docs/#api-week

Activity icon

Replied to DateFormat For Pivot Table Data With WithTimestamps()

Does your pivot model extends the Pivot class?

use Illuminate\Database\Eloquent\Relations\Pivot;

class MerchantProduct extends Pivot
{
}

You also need to be specific in your relationship, that it should be using that Pivot class

public function products()
{
        return $this->belongsToMany('App\Product')->using('App\MerchantProduct')->withTimestamps();
}

Now it should parse the dates correctly ;)

Activity icon

Replied to Email Verification 403 And Rewriterule On .htaccess File

403 sounds like another problem and not the URL. Do you have an example of the generated URL?

Activity icon

Awarded Best Reply on Access Denied On New Resource Controller

I see that you have a custom SoccerRequest class. This class usually has two methods. authorize and rules. To access this controller now, the authorize method should return true

class SoccerRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }
    
    public function rules()
    {
        return [];
    }
}
Activity icon

Replied to Best Way To Sway Clients Away From Using WordPress

If you don't want to work with WordPress, the client might be someone you shouldn't be doing business with ;)

Activity icon

Replied to Access Denied On New Resource Controller

I see that you have a custom SoccerRequest class. This class usually has two methods. authorize and rules. To access this controller now, the authorize method should return true

class SoccerRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }
    
    public function rules()
    {
        return [];
    }
}
Activity icon

Replied to Calculate Week Number With Dates

Laravel comes with Carbon by default. This is a very good library that can help you transform dates to other dates.

Here is an example

$date = Carbon::parse('2019-01-19 16:00:00');

$weekOfYear = $date-> weekOfYear;

$startOfWeek = $date->startOfWeek()->toDateString();
$endOfWeek = $date->endOfWeek()->toDateString();

You can find all these methods here: https://carbon.nesbot.com/docs/#api-week

Activity icon

Replied to API Documentation Generator

I always find this a good package to use: https://github.com/mpociot/laravel-apidoc-generator

To be honest, I rather have this documentation outside the application. Adding all these docblocks just to be able to generate it, makes it tedious process.

Activity icon

Replied to Table In 2nd Page To Display On Top

I don't see your HTML, but it looks like you're inside a table layout as well. If that is the case, then all content is centered horizontally by default. If you don't want that, you have to do something like this

.some-class {
    vertical-align: top;
}

It works better if you would share a jsfiddle link for example. This way we can also see how your HTML and CSS is structured.

Activity icon

Replied to Form Builder With Drag And Drop For Nova

Currently, there is no such package. Also, I don't think this is a really good case for Nova. You're better off with a custom build CMS or some other system that supports this. Nova is built to general for this.

Activity icon

Replied to Code Quality Check

This seems like a hickup at gitlab.com. Are you running on the latest version of gitlab.com? I never experienced something like this!

Are you running a self-hosted version of GitLab?

Also, can you share the config of the job you're trying to execute?

Activity icon

Replied to Correct Way To Use Mix For JQuery?

@mikea After 7 months ;)

Activity icon

Replied to Create Directory And File With Queue

It seems that you don't have any exception handling in your handle method. So if something goes wrong after x times. If the job fails, you should see the output in the failed_jobs table.

Another issue might be that the files are too large to process as the payload of the request. In that case, it might be better to store the file itself on some location in the controller and kick off the job that will parse it to a different size.

Jan
18
1 day ago
Activity icon

Replied to How To Put The Description Under The Image In Carousel?

Do you have an example of what you want to achieve?

Depending on your stack, but I'm a big fan of owl carousel. You have a ton of options with this.

Activity icon

Awarded Best Reply on Repetitive Code

I think it's fine to check this in your listener. In most cases, you just want to be able to trigger an event with one or more listeners. Every listener might do something based on the current context of the user. So this is the perfect place to do so ;)

Activity icon

Replied to Routing

What is your question? What exactly is not working?

In most cases, you give each route a name and based on that you can determine the route

{
    path: '/item/:id',
    name: 'item_show',
    component: showDetail,
}

<router-link :to="{ name: 'item_show', params: { id: item.id }}">read  more</router-link>

Documentation: https://router.vuejs.org/api/#router-link-props

Activity icon

Replied to Repetitive Code

I think it's fine to check this in your listener. In most cases, you just want to be able to trigger an event with one or more listeners. Every listener might do something based on the current context of the user. So this is the perfect place to do so ;)

Activity icon

Replied to Git Error RPC Failed; Curl 56 OpenSSL SSL_read: Connection Was Reset

By best guess is that your internet is really slow (225 kb/s). Have you tried it on another network or wired network?

Otherwise, it might be some firewall. In that case, you can try a different network and see if that works.

Activity icon

Replied to Laravel Authntication Options

Yeah, you can. However, it doesn't come by default with Laravel. You either need to use a package or build it yourself.

This is a good blog to get started with this in Laravel: https://medium.com/@darutk/oauth-2-0-and-openid-connect-implementation-in-laravel-authlete-4d32802ab335

Jan
17
2 days ago
Activity icon

Awarded Best Reply on Login Error Not Return Message

You're not calling the sendFailedLoginResponse method that was in the original code of the login method. You can find the original method here: https://github.com/laravel/framework/blob/6.x/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php#L54

You need to copy the full method and then make your changes.

Activity icon

Replied to Laravel 6 - Security Consideration When Building 'Formidable Pro' Style Form Builder

You can decide to specify a type per field. For example, a checkbox should be of type boolean. A select would always be a certain set of options you can pick from. You can easily validate these kinds of types of inputs.

For third party stuff, I would recommend to always escape the data. An alternative would be having an HTML/markdown type.

Activity icon

Awarded Best Reply on Edit Links

This sounds like a perfect case for signed URLs. These are the same kind of URLs that are used whenever you need to verify your email in the register flow that comes with Laravel.

The benefit of signed URLs is that you can decide how long the URL should be accessible and so on.

Documentation: https://laravel.com/docs/6.x/urls#signed-urls

Activity icon

Replied to Edit Links

This sounds like a perfect case for signed URLs. These are the same kind of URLs that are used whenever you need to verify your email in the register flow that comes with Laravel.

The benefit of signed URLs is that you can decide how long the URL should be accessible and so on.

Documentation: https://laravel.com/docs/6.x/urls#signed-urls

Activity icon

Replied to Sharing Data Between 2 Laravel Applications

Probably just sharing the same database works best.

Curious why you're not just making one application that has two interfaces. Based on roles you access functionality A or functionality B.

If you work in two applications you also need to define the models twice and so on.

Activity icon

Replied to Login Error Not Return Message

You're not calling the sendFailedLoginResponse method that was in the original code of the login method. You can find the original method here: https://github.com/laravel/framework/blob/6.x/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php#L54

You need to copy the full method and then make your changes.

Activity icon

Replied to Valet And Connecting To Database.

Laravel Valet assumes that you have a mysql server running yourself locally. You can't connect to the database by default. If you want that you need to install a tool like PHPMyAdmin. In general just putting 127.0.0.1 in the .env for the DB_HOST key should be enough to make your application connect to your local database.

If you need a database, try MySQL by running brew install [email protected] on your command line. Once MySQL has been installed, you may start it using the brew services start [email protected] command. You can then connect to the database at 127.0.0.1 using the root username and an empty string for the password.

Documentation: https://laravel.com/docs/6.x/valet#installation

Activity icon

Awarded Best Reply on Extra Guards Break Application

You removed the web guard, so that's why your applications break. Make sure you add it again

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],
    // Other guards
],
Activity icon

Replied to Extra Guards Break Application

You removed the web guard, so that's why your applications break. Make sure you add it again

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],
    // Other guards
],
Activity icon

Replied to Testing Notifications

In most cases, you can pass in a third argument with a callback to verify the content of the notification

Notification::assertSentTo($this->user, WelcomeEmail::class, function (WelcomeEmail $notification, $channels, $notifiable) {
    $mailData = $notification->toMail($this->user)->toArray();

    this->assertEquals('Welcome to the app', $mailData['subject']);

    return $notifiable->routes['mail'] === '[email protected]';
});

Let me know if this works for you ;)

Activity icon

Replied to Explanation Needed On Laravel Relationships

The difference here is that ->loans() will create a new query builder object, so basically performing a new query in all cases.

->loans will perform the action on the collection. If there are no loans loaded it will try to fetch them. If they have been loaded before by with with for example it will use that.

However for ->create you always need to use loans() as far as I know. Because you're performing a new query. It doesn't make sense to call create on the collection. In other cases, you need to think about if you want a new query or a collection.

Activity icon

Replied to I Need Help

It seems that you're using Laravel 6, but this package is only compatible with Laravel 5.0 to 5.8. So you have three options here. Find another package. Or install Laravel 5.8. Contact the author of the package and ask them to make this available for Laravel 6 as well, or you can create your own pull request to do so.

The second option, installing Laravel 5.8, is the worst option at this point since it will be deprecated this February.

Anyway, if you read the message correctly it says it's not compatible with your current Laravel version.

inani/larapoll 2.5 requires illuminate/support ~5
Jan
16
3 days ago
Activity icon

Replied to Laravel Verify Email Error

What exactly are you trying to do? I only see the error but miss some context. Can you show the mailable class you try to send?

Activity icon

Replied to Laravel Passport Token Idle Time Setting?

The tokensExpireIn is used for all regular access token, like you would use with a client token. The are different than personal access tokens because the token is connected to a client and a secret. The client might be connected to a user or an team, etc.

The personalAccessTokensExpireIn is for personal access tokens only. They are defined a different way and are connected most of the time to a user.

The refreshTokensExpireIn is for all refresh token of any kind.

You may set the expire date of a token yourself in the database. For each token a record is created in the oauth_access_tokens table. Here you can set the expires_at date to your preferences. Passport offers method to get the token from a user. You can find all that in the docs ;)

Jan
15
4 days ago
Activity icon

Replied to Viewing Files In Nova Instead Of Downloading Them

At this point, it's not possible to do that in Nova. If you want this kind of functionality you have to build it yourself. You can easily create your own File component for this ;)

Jan
14
5 days ago
Activity icon

Replied to Multiple Subdomains On Shared Hosting.

They all need to use the same way of authentication using a token for example.

Activity icon

Replied to What's Wrong With My Sql Query?

The query looks oke. Do you get an error? What exactly is not working for you?

Jan
13
6 days ago
Activity icon

Awarded Best Reply on Logging Out Other Devices Not Working After Overriding Login Function

Yeah, you override a bit too much. Normally the authenticated method is called. In your case, you can do something like this

if (Auth::attempt($request->only($login_type, 'password'))) {
    $this->authenticated();

    return redirect()->intended($this->redirectPath());
}

You can find the original code here: https://github.com/laravel/framework/blob/6.x/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php#L23

Activity icon

Replied to 404 On Auth Routes

Can you post your routes/web.php file?

Activity icon

Replied to Spatie Sitemap Generates Xml File But No Link Is Added

Question 1: Not sure

Question 2: If you want to generate it per post, you have to add them in a loop

Route::get('sitemap', function () {
    $sitemap = SitemapGenerator::create('http://127.0.0.1:8000')->getSitemap();

    $sitemap->add(Url::create('/')->setPriority(0.5));

    foreach (Post::all() as $post) {
        $sitemap->add(Url::create('/admin/en/post/' . $post->id)->setPriority(0.5));
    }
    
    $sitemap->writeToFile('sitemap.xml');

    return "Sitemap Generated";
});

Something like this should work ;)

Another solution is using the crawler, which will try to find all the links and open them. But in that case, you might miss some URL's if they are not on pages available.

Activity icon

Replied to QR Code Alternatives

Yeah, you can use the camera to scan a number as well. As long as you put a border around it. A QR code is also scanned from the camera right? Text is easy to scan as well ;)

For security purposes, I would recommend you to generate some URL in your QR data that points to some project that is always behind authentication. This way you can make sure that no one can access the URL without being logged in.

You also then need checks to see if this data matches with the current user, but I think you already have that covered ;)

Activity icon

Replied to 404 On Auth Routes

Do you still have the Auth::routes() call in your routes/web.php file?

You never have to cache your routes locally. This will give you random problems like this.

Activity icon

Awarded Best Reply on QR Code Alternatives

This seems to be a very good API: http://goqr.me/api/

Verifying can indeed be done in many ways. A QR code is pretty fancy, but I think just a random generated number is also perfectly fine. You can also scan for that if you wish.

Activity icon

Awarded Best Reply on Update Value Inside Delete Method

Sure you can. You already have the object right?

$self=SelfBook::where('id',$id)->firstOrFail();

$self->update([
    'field' => 'value',
]);
Activity icon

Replied to SQLSTATE[42000]: Syntax Error Or Access Violation

What is the error you get? Does the database already exist?

Try running this once php artisan migrate:fresh

Activity icon

Replied to Logging Out Other Devices Not Working After Overriding Login Function

Yeah, you override a bit too much. Normally the authenticated method is called. In your case, you can do something like this

if (Auth::attempt($request->only($login_type, 'password'))) {
    $this->authenticated();

    return redirect()->intended($this->redirectPath());
}

You can find the original code here: https://github.com/laravel/framework/blob/6.x/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php#L23