bobbybouwmann

bobbybouwmann

Developer at Enrise

Member Since 5 Years Ago

Apeldoorn, The Netherlands

Experience Points
1,948,835
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
1748
Lessons
Completed
Best Reply Awards
2569
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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,948,835 XP
Sep
19
22 hours ago
Activity icon

Replied to Does Nova Works With JetStream?

Nova has by default it's own authentication form. However, if you use the same authentication driver for Jetstream as for Nova you should be able to log in to your normal application and then open up Nova without any extra actions. I'm not sure about the other way around, because for 2FA you need extra steps which I believe are not built in right now for Nova.

Activity icon

Replied to How To Access Time Stamp In Api Controller For Pivot Table

The data should be available under the pivot key of the History model.

@foreach ($records as $record)

    {{ $record->pivot->created_at }}

@endforeach

If you want to convert these fields to Carbon objects automatically, you can create a pivot model. You can read more about it here: https://laravel.com/docs/8.x/eloquent-relationships#defining-custom-intermediate-table-models

Activity icon

Replied to Does Nova Works With JetStream?

Nova and Jetstream are two completely different things. Nova can be seen as an admin panel, where jetstream is part of the interface for your users.

You can perfectly combine the two in one application. Nova is connected to the same authentication by default as your application. However, you normally have an extra check for admin users as an example.

Activity icon

Replied to How To Use Multiple Filters In Spatie Query Builder

Well, Laravel can only include the events once. So if you need both, you need to build up the query you want to use for events by combining both filters in the callback and then call it using with.

Same goes for the whereHas part. So if you really want this you should combine the two in one filter, that is the easiest solution here ;)

Sep
18
1 day ago
Activity icon

Replied to 502 Bad Gateway

Well, the path in your config is incorrect. Try this instead

folders:
    - map: C:/Users/STECHMAX/Homestead/code
      to: /home/vagrant/code

So. make sure you use the correct path everything. The same goes for your SSH key in the config file. You need to use the correct path there as well.

Here is a tutorial that always works for Windows: https://medium.com/@eaimanshoshi/i-am-going-to-write-down-step-by-step-procedure-to-setup-homestead-for-laravel-5-2-17491a423aa

Activity icon

Replied to Queue: Max Attempts ExceededException

Well, the error is pretty clear, right? The job throws an exception every time you run it, after X times it stops trying it and it stops.

You should be able to see the errors in the failed_jobs table.

If this works locally, there must be something different on your production environment. Are you using the correct email credentials? Maybe you have an other bug on production you didn't found locally. Did you restart Horizon after a deployment? Otherwise it's still running the old code.

Activity icon

Replied to How To Convert Form Collection To HTML Input Field

You can do this for that

{!! Form::select(
    'leave_applicable_gender', 
    AppHelper::APPLICABLE_GENDER, 
    $applicableGender ?? 1, 
    ['class' => 'form-control select2', 'required' => 'true']
) !!}

As you can see in the third argument we give it a default value if $applicableGender is null. So if you don't know the value yet, you can always use this approach to select the first item.

Activity icon

Replied to Laravel8 With Fontawesome

I expect you use the latest version which you installed like so

npm install @fortawesome/fontawesome-free 

You should then import them like this

// resources/sass/app.scss

@import '[email protected]/fontawesome-free/scss/brands';
@import '[email protected]/fontawesome-free/scss/regular';
@import '[email protected]/fontawesome-free/scss/solid';
@import '[email protected]/fontawesome-free/scss/fontawesome';

Only include what you really need ;)

Activity icon

Replied to Intercept Misstokenmissmatch In Laravel 8

That would have given you a different error if that really was the case... But glad you found the correct solution.

Activity icon

Awarded Best Reply on Multi Role Social Login Or Register Laravel

Yeah, you can't adjust the URL here, because the redirect URL will be the same for all roles. What you can do is set a session before you redirect and use that session to determine the correct role

public function redirect($service)
{
    session()->set('role', request()->segment(4));

    return Socialite::driver($service)->redirect();
}

public function callback($service)
{
    $role = session()->get('role');

    $user->assignRole($role);

    // More code here

    return $this->respondWithToken($token);
}

Well, you get the idea :)

Sep
17
2 days ago
Activity icon

Commented on Guzzle API Requests With Tests

We need to swap the client, so we can use a fake client. This way we don't actually perform a request, but we fake the request.

You can read more about the HandlerStack here: http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html#handlerstack

Activity icon

Replied to Intercept Misstokenmissmatch In Laravel 8

@yoman How is the code different than the code from above?

Aah, wait I see it. You forgot the use statement, right?

Activity icon

Replied to Laravel Jetstrean Form Submission

It shouldn't be. What preset are you using with Jetstream?

Activity icon

Replied to Validation Doesn`t Work

@ivanradojevic Happens to the best of us ;)

Activity icon

Replied to Multi Role Social Login Or Register Laravel

Yeah, you can't adjust the URL here, because the redirect URL will be the same for all roles. What you can do is set a session before you redirect and use that session to determine the correct role

public function redirect($service)
{
    session()->set('role', request()->segment(4));

    return Socialite::driver($service)->redirect();
}

public function callback($service)
{
    $role = session()->get('role');

    $user->assignRole($role);

    // More code here

    return $this->respondWithToken($token);
}

Well, you get the idea :)

Activity icon

Replied to Render Anonymous Component From A String

I don't think it's possible then.

The components should be rendered by blade, but in this case your component is not parsed as blade anymore because the variable is already parsed a blade in an earlier stage.

Activity icon

Replied to Render Anonymous Component From A String

Have you tried echoing it out as raw HTML like so

{!! $html !!}

If the above doesn't work, then I don't think there is a way to do this right now. This is because of how the content gets rendered by blade. Anyway, give the above a try ;)

Activity icon

Replied to Multi Role Social Login Or Register Laravel

The code looks fine to me, as long as the URL is correct of course. The redirect URL in the redirect method is pure to redirect to the correct Socialite service.

I'm not sure what exactly the problem is here.

Activity icon

Awarded Best Reply on Validation Doesn`t Work

Could be a typo for one of the fields in your form?

Can you post your form here?

Activity icon

Replied to Blade View For Rich Text Field On Description Tag

@lara-dom That exactly what I told you in the first reply ;)

Glad you got it working :D That's the most important thing.

Activity icon

Replied to Validation Doesn`t Work

Could be a typo for one of the fields in your form?

Can you post your form here?

Activity icon

Replied to Multi Role Social Login Or Register Laravel

What exaxtly is the problem here? The $access_url is always null? Or is it going wrong somewhere else?

Activity icon

Replied to Laravel Jetstrean Form Submission

Livewire shows a popup when you get an error. Did you check your storage/logs files? Maybe you can find some details in there. Otherwise I have no clue why you would get this.

Activity icon

Replied to Code Editor

I would highly recommend PHPStorm. PHPStorm is full IDE and has all features for clicking to the next class, see where methods are used, auto completions, and easy refactoring short cuts. This is just a small part of all the features you get.

PHPStorm is heavier then Sublime or VSCode but it also offers a lot more features ;)

Activity icon

Replied to Is There A Way Of Translating The Website Based On The User's Locale(language) In Laravel Without Using Google Translate Package?

Yeah, you can create all the translations yourself and put them in resources/lang ;)

However, if you want to have your whole website translated with dynamic content you should definitely use a third party package like Google Translate. You're probably hitting the requests limit because you use the free version. With a paid option you don't have this issue.

Another solution that might work is translating it once using Google translate and then cache the whole page. This way you can serve it translated without doing the API request all the time.

Activity icon

Replied to Intercept Misstokenmissmatch In Laravel 8

Laravel still throws this exception. Nothing has functionality changed for this in Laravel 8.

Are you sure a TokenMismatchException is thrown? If your application somewhere returns a 419 as a response you won't be able to capture it using above code.

Activity icon

Replied to Laravel - Vuejs Two Link For Switch Between

Well, this depends on a lot of things. Do you use the vue-router? Is the language something you only handle in the frontend or also in the backend?

There are loads of tutorials out there about this:

Activity icon

Replied to Can't View Site With IP Or Domain

Laravel Forge sets up a nginx file that only works based on the domain. So if you for example create a site called example.com then you can only access it through that name.

If you run multiple domains, nginx can't know which site you intent to go to so it returns nothing. Both sites run under the same IP because it's the same server. So you need to be explicit by using the domain name.

If the domain name doesn't work, you need to update your DNS config so that it points to the correct IP of the server.

Activity icon

Replied to Laravel 7 Segmentation Fault (core Dumped) When Try To Login

So, the vertica driver is not installed correctly.

Did you update your AppServicePorvider with the correct content?

Activity icon

Replied to How To Keep Running Laravel Websockets Using Laravel Cron Jobs ?

In short: You can't.

You need to have a background process that keeps running the WebSocket for you. Also, you need a different port for your WebSocket server. Because you're on shared hosting an extra port is probably blocked. This is how PHP is designed and shared hosting is simply not set up for this. You need your own server where you have more flexibility. You can read a more detailed answer here: https://stackoverflow.com/a/55987092

However, there is a solution to make this work. Simply replace the WebSocket on your own server with a WebSocket as a service like Pusher. Pusher is supported out of the box by Laravel and offers almost the same functionality. You can use the broadcast system from Laravel to send out a message to Pusher, where Pusher will broadcast it to all subscribers (listening sockets).

Documentation: https://laravel.com/docs/8.x/broadcasting

Activity icon

Awarded Best Reply on Mysql DATETIME Doesn't Accept High Dates (10+ Years From Now)

Are you using a datetime column in your database or a timestamp column?

The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.

The DATETIME data type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.

Activity icon

Replied to Mysql DATETIME Doesn't Accept High Dates (10+ Years From Now)

Are you using a datetime column in your database or a timestamp column?

The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.

The DATETIME data type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.

Activity icon

Replied to Blade View For Rich Text Field On Description Tag

When you use {!! !!} Laravel will output the raw content. So if you have HTML tags in there, they will stay as well. However, your meta tags shouldn't have any HTML in there. If you echo out your content using {{ }} Laravel automatically strips the HTML tags for you. So in this case, you should be using this

@section('description', {!! $item->description !!} )

<meta property="og:description" content="{{ $item->description }}">
Activity icon

Replied to Laravel 7 Segmentation Fault (core Dumped) When Try To Login

Are you using an odbc driver/package for Laravel? Without it, Laravel will try to perform regular queries and use a regular connection to do that. If your database is not compatible with that you might get these weird errors. You have to use an eloquent compatible driver to make this work.

You can also check the log files in storage/logs. Maybe you can find some direction in htere.

Sep
16
3 days ago
Activity icon

Awarded Best Reply on Bold Text Through Controller In Email

You need to parse the raw HTML in your view or use markdown to make this work. Sending regular HTML will not be converted in most cases. If you already use a view, you need to make sure you use the correct tags {!! $body !!}

For markdown check this part of the docs: https://laravel.com/docs/8.x/mail#writing-mailables

Activity icon

Awarded Best Reply on Multiple Auth Guards Vs Roles / Permissions

Yeah, so I would always go with the roles/permissions way for the authentication part. This way you can just have one way to log in.

You can split the login form or you can use the same form for all roles. Based on their role you can redirect them to another page where they can see their actions. For example, a separate vendor dashboard. You can use different login URLs of course where you only allow users to login with a certain role. This is a small adaption to the current login flow by just checking on the role as well. You can even create your own controller for it if needed.

You can always use middleware or permission based on the current role of the user to determine where they can go or what they can see.

Multi auth always makes it more complex, while in your case you just have users that log in but have different permissions

Activity icon

Replied to Bold Text Through Controller In Email

You need to parse the raw HTML in your view or use markdown to make this work. Sending regular HTML will not be converted in most cases. If you already use a view, you need to make sure you use the correct tags {!! $body !!}

For markdown check this part of the docs: https://laravel.com/docs/8.x/mail#writing-mailables

Activity icon

Replied to Multiple Auth Guards Vs Roles / Permissions

Yeah, so I would always go with the roles/permissions way for the authentication part. This way you can just have one way to log in.

You can split the login form or you can use the same form for all roles. Based on their role you can redirect them to another page where they can see their actions. For example, a separate vendor dashboard. You can use different login URLs of course where you only allow users to login with a certain role. This is a small adaption to the current login flow by just checking on the role as well. You can even create your own controller for it if needed.

You can always use middleware or permission based on the current role of the user to determine where they can go or what they can see.

Multi auth always makes it more complex, while in your case you just have users that log in but have different permissions

Activity icon

Replied to FirstOrCreate

I'm in the @hehihik camp.

@michaloravec You replied very fast, but only with the property name. That is not helpful for a lot of people.

Activity icon

Awarded Best Reply on FirstOrCreate

If the model is created using the firstOrCreate method you can use the wasRecentlyCreated to determine that. This is set to true when the model is created in the current request.

if ($model->wasRecentlyCreated) {
    // Created
} else {
    // Fetched from database
}
Activity icon

Replied to FirstOrCreate

If the model is created using the firstOrCreate method you can use the wasRecentlyCreated to determine that. This is set to true when the model is created in the current request.

if ($model->wasRecentlyCreated) {
    // Created
} else {
    // Fetched from database
}
Activity icon

Replied to Image Not Loaded Using Ckeditor Upload Image

You shouldn't use the " around the route part because it's now being parsed as a string, not as PHP. Try this instead

<script>
    CKEDITOR.replace('content', {
        filebrowserUploadUrl: {{ route('ckeditor.upload', ['_token' => csrf_token()] )}
    });
</script>
Activity icon

Replied to How To Update Livewire Components Data With ScopeWithFilters?

You need to make sure these paremeters are set in your component. By that, I mean the public properties of your livewire component. If they are empty, you need to pass sain defaults to the withFIlters method.

Activity icon

Replied to How To Change DateFilter Format?

@keizah Awesome! That's the way to go for now ;)

Sep
15
4 days ago
Activity icon

Awarded Best Reply on Can I Use Vue And React Together With Laravel?

Sure, as long as you compile your assets correctly. You can compile multiple javascript files using Laravel Mix and give them a different name. This way you can include both of them.

In general, it's recommended to stick with one framework because you will load a lot more javascript on the page with two frameworks. I can't imagine that you can't make a video call work in Vue, but I also understand that React probably makes this easier ;)

Is there a reason why you don't build everything in React? Or do you already have a part done in Vue?

Activity icon

Replied to Can I Use Vue And React Together With Laravel?

Sure, as long as you compile your assets correctly. You can compile multiple javascript files using Laravel Mix and give them a different name. This way you can include both of them.

In general, it's recommended to stick with one framework because you will load a lot more javascript on the page with two frameworks. I can't imagine that you can't make a video call work in Vue, but I also understand that React probably makes this easier ;)

Is there a reason why you don't build everything in React? Or do you already have a part done in Vue?

Activity icon

Replied to Spatie\MediaLibrary\Exceptions\FileCannotBeAdded\FileDoesNotExist File Does Not Exist

You say you want to show the text, but you use an <img> tag?

So how does the $photo object look like?

Activity icon

Replied to How To Update Livewire Components Data With ScopeWithFilters?

You didn't pass the to the method!

scopeWithFilters now expects 2 parameters, the category, and the order. If you don't pass that it fails of course.

Activity icon

Awarded Best Reply on Where To Locate Validation Rules And Rules Based On HTTP Verbs

I would probably just create two arrays with rules in your model and use that instead.

Maybe even put it in a constant instead of a method, but that is up to you.

class Model
{
    public const RULES_CREATE = [
        'email' => 'required|email',
        'name' => 'required',
    ];

    public const RULES_UPDATE = [
        'name' => 'required',
    ];
}

Another alternative would be using a separated class which only has the constants so your model is not completely filled with just this data

class ModelConstants
{
    public const RULES_CREATE = [
        'email' => 'required|email',
        'name' => 'required',
    ];

    public const RULES_UPDATE = [
        'name' => 'required',
    ];
}
Activity icon

Replied to How To Update Livewire Components Data With ScopeWithFilters?

You should first debug if request('category') is actually returning something. It also seems you pass the $this->categoryand $this->order to the query but you don't have those variables in your method. I would expect an error there.

Livewire offers options to get the value from the query string and pass it to your component

public $category;
public $order = 'latest';
protected $queryString = ['category', 'order'];

public function updated()
{
    return Series::where('approved' , 1)->withFilters($this->category, $this->order)->paginate(9);
}

public function scopeWithFilters($query, $category, $order)
{
    if (isset($category) && trim($category) != '') {
        $query->whereHas('categories' , function ($query) use ($category) {
            $query->whereId($category);
        });
    }

    if ($order !== 'latest') {
        if(request('order') === 'oldest') {
            $query->oldest();
        }
    } else {
        $query->latest();
    }

    return $query;
}

Documentation: https://laravel-livewire.com/docs/2.x/query-string