bobbybouwmann

bobbybouwmann

Developer at Enrise

Member Since 5 Years Ago

Apeldoorn, The Netherlands

Experience Points
1,559,965
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
1571
Lessons
Completed
Best Reply Awards
1991
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,559,965 XP
Dec
09
5 hours ago
Activity icon

Replied to Is There Some Api Consumer Package ?

I would personally still use Guzzle for your use case. I always build wrappers around guzzle and use that. So if you, for examplehave a call to fetch all customers from some API I build a wrapper around that calledCustomerService`. In there you can do all the guzzle logic.

Also for reusing guzzle clients, I put them in the container as a singleton. This way you can dependency inject them and reuse them in different service classes.

Dec
08
1 day ago
Activity icon

Awarded Best Reply on Laravel 6, CORS Problem

I'm not sure what the problem is, to be honest.

Anyway, there is a very good package that can take of this for you: https://github.com/barryvdh/laravel-cors

Dec
07
2 days ago
Activity icon

Awarded Best Reply on Cross Site Form Submit

There is also a great Laravel package for that: https://github.com/barryvdh/laravel-cors

Activity icon

Awarded Best Reply on Google Calendar Events

Spatie has a package for this and its pretty good! You can find all the information you need here: https://github.com/spatie/laravel-google-calendar

In the README of the package, you can find an explanation of how to set up stuff the correct way in Google and in your application ;)

Activity icon

Replied to Laravel 6, CORS Problem

Yeah, you need to remove your own middleware and use the middleware provided by the package. You can find all of that in the readme of the package.

After you have enabled the middleware you can configure everything in the config file of the package. The readme should make all of that very clear ;)

Activity icon

Replied to Cross Site Form Submit

There is also a great Laravel package for that: https://github.com/barryvdh/laravel-cors

Activity icon

Replied to Cross Site Form Submit

Yes, it's possible! You need CORS headers for that

Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Activity icon

Replied to Throttles Login

Well the throttle key is generated based on the given username and IP address

protected function throttleKey(Request $request)
{
    return Str::lower($request->input($this->username())).'|'.$request->ip();
}

So in your case, you can't really use the default behavior of Laravel, since the value of the username() method will either return the email of the id of the user. So you would need to override this method or create something custom with a unique identifier to make this work. Only the IP-address is not an option. That would block users too fast if they are on the same network.

Dec
06
3 days ago
Activity icon

Awarded Best Reply on Spatie Tags

Well, your code actually returns an array indeed

{{ $post->tags()->get() }}

If you want to display the data as a string in your code you need to loop over it and display each item. Something like this should work

<h3 clas="card-title">
    @foreach ($post->tags as $tag) 

        <a href="{{ url('tags/' . $tag->id) }}">{{ $tag->name->en }}</a>

    @endforeach 
</h3>
Activity icon

Awarded Best Reply on How Can I Get Last Object In Array

You can probably do something like this

let last = arr[arr.length - 1];
Activity icon

Replied to How Can I Get Last Object In Array

You can probably do something like this

let last = arr[arr.length - 1];
Activity icon

Replied to Google Calendar Events

Spatie has a package for this and its pretty good! You can find all the information you need here: https://github.com/spatie/laravel-google-calendar

In the README of the package, you can find an explanation of how to set up stuff the correct way in Google and in your application ;)

Activity icon

Replied to Validation Nested Attributes

This is native behavior.

Activity icon

Awarded Best Reply on Set Email_verified_at To Null

You can't update this field, because it's protected. So if you want to update this field you have two options.

1: Mark the field as fillable in your model

class User extends Authenticatable
{
    $fillable = ['email_verified_at'];
}

2: force fill the field

$user->forceFill(['email_verified_at' => null]);

I prefer option 1, but that is up to you ;)

Activity icon

Replied to Update/Recalculate Pagination After Dropping Some Items From Collection

You have to first filter out all the results you don't want using forget. After that, you need to paginate manually. You can't use the Laravel default query paginator since that is working based on the query and not the results you removed from it.

You can create your own pagination object like so

$users = Item::all();

$page = $request->input('page', 1); // Get the ?page=1 from the url
$perPage = 15; // Number of items per page
$offset = ($page * $perPage) - $perPage;

return new LengthAwarePaginator(
    array_slice($users->toArray(), $offset, $perPage, true), // Only grab the items we need
    count($users), // Total items
    $perPage, // Items per page
    $page, // Current page
);

This should make your query work as well ;)

Activity icon

Replied to How Do I Make This Validation Only Appear When I Start Writting?

Probably because you fill the data (email and password) with an empty string. If you use null instead the validation should not work

data() {
    return {
        email: null,
        password: null,
    }
},
Activity icon

Replied to Set Email_verified_at To Null

You can't update this field, because it's protected. So if you want to update this field you have two options.

1: Mark the field as fillable in your model

class User extends Authenticatable
{
    $fillable = ['email_verified_at'];
}

2: force fill the field

$user->forceFill(['email_verified_at' => null]);

I prefer option 1, but that is up to you ;)

Dec
05
4 days ago
Activity icon

Replied to Laravel 6, CORS Problem

I'm not sure what the problem is, to be honest.

Anyway, there is a very good package that can take of this for you: https://github.com/barryvdh/laravel-cors

Activity icon

Replied to How To Mock Model's Static Function In Phpunit?

That's why you have a test database right? Or tools to actually reset the database after each test: https://laravel.com/docs/6.x/database-testing#resetting-the-database-after-each-test

Activity icon

Awarded Best Reply on Screenshots Automatically

You can use a tool like puppeteer to do that. You can then convert it to an image or a pdf for example.

Here is a useful package: https://github.com/spatie/browsershot

Activity icon

Replied to Spatie Tags

Well, your code actually returns an array indeed

{{ $post->tags()->get() }}

If you want to display the data as a string in your code you need to loop over it and display each item. Something like this should work

<h3 clas="card-title">
    @foreach ($post->tags as $tag) 

        <a href="{{ url('tags/' . $tag->id) }}">{{ $tag->name->en }}</a>

    @endforeach 
</h3>
Activity icon

Replied to Screenshots Automatically

You can use a tool like puppeteer to do that. You can then convert it to an image or a pdf for example.

Here is a useful package: https://github.com/spatie/browsershot

Activity icon

Replied to How To Run A Php Artisan Command For Https Host

Not sure what your question is? Do you want to run php artisan on a remote server?

Activity icon

Replied to Laravel - Recursive Relationships Without Some Data

Nope, you can't. This is how Laravel relationships work. It needs the models to combine the results from the different queries. You might be able to select fewer columns in your relationships, since hasMany is a query builder as well. However, you need to make sure you always select the primary and/or foreign key.

Activity icon

Replied to How To Implement MediatR And CQRS In Laravel PHP?

There are different packages which you can use. Which one to use is up to you. They all have their pros and cons:

I'm a big fan of eventsauce :)

Activity icon

Replied to Laravel Passport

@beyond Please mark it as the best reply if you think this is the best reply. This might help others as well ;)

Activity icon

Replied to AWS S3 Acess/permissions Issue

@deepak1234 Please create a new thread. Asking a new question on an existing thread won't get you the answers you need.

Activity icon

Replied to Old Value Of Check Box

@nakov Has given up! That's something...

Activity icon

Replied to Deploy On Multiple Server: Question About .env File

I'm not sure if you can! You can ask the support of Envoyer if this is possible. The other solution is managing the .env per server, but this way you can't sync it anymore to other servers.

Activity icon

Replied to How To Write A Package For Laravel

These courses already help you get on the right path. If you like to read you can find a blog series here: https://johnbraun.blog/posts/creating-a-laravel-package-1

For standards, you can also look at other packages ;)

Activity icon

Replied to How To Mock Model's Static Function In Phpunit?

Mmh, this is indeed hard to test. Mocking your models in is general hard to do and in my opinion a bad practise. If I'm looking at your code I see that you call some url that triggers a controller which returns a view. Why don't you test against that

public function testEventIndex()
{
    $this->loginWithFakeUser();

    $response = $this->call('GET', action('User\[email protected]'));

    $response->assertOk()
        ->assertViewIs('user/event.overview.index')
        ->assertViewHas('event_overviews');
}

You can find more like these methods here: https://laravel.com/docs/6.x/http-tests#available-assertions

Note: Testing should be fun and easy ;) Don't try to mock what you don't own like the way models work on Laravel :D

Dec
04
5 days ago
Activity icon

Replied to Send Mail Using Selected Template Store In Db

You can use Mail::raw for that

 Mail::raw($content, function ($message) {
    $message->to('[email protected]');
 });

Not that you need to combine the content and the data yourself before passing it to the rawz method :)

Activity icon

Replied to Developing Wordpress Theme

This is a good book: https://www.kobo.com/us/en/ebook/pro-wordpress-theme-development

However, just reading the docs and watching free videos on YouTube should already get you very far ;)

Dec
03
6 days ago
Activity icon

Replied to Validation Using Request

Extend Store here doesn't make any sense in this case. Extending it doesn't bring extra value at this point. It could be in the future, but not right now. Sometimes you want to reuse rules for create and update then extending is an option. I personally would never take that approach.

The reason for using php artisan make:request is pure to separate the logic of validation so your controller is still readable ;)

Activity icon

Replied to How Do You Validate A Json Object In With An Npm

@abduljakul-salsalani Well, reading the documentation is really important to get a good understanding of the framework. The reason that I can help you is because I did read the documentation multiple times while working on applications :)

Activity icon

Replied to Property [academic_id] Does Not Exist On This Collection Instance

@sinnbeck Aaah good catch! It's not an array of models anymore, but an array of grouped arrays of models. Therefore the first academic_id key doesn't exist in the first array.

Activity icon

Replied to Using GroupBy() On Table Relations

Well group by works on the first query and not on the relationship. If you dive into relationships you will find out that if you use with it will perform two queries. Right now it will perform the following queries for you

// Eloquent
Place::with(["plans"])->groupBy("place_name")->get(); 

// Queries
select * from places group by place_name;

select * from plans where place_id in (1,2,3,4);

This is how Eloquent works.

Because of this only, the plans of one of the selected places will be returned instead of all the places that have been grouped. This is because the first query does the group and the second then collects the plans. So to fix this you need a join or a different query ;)

Activity icon

Replied to Property [academic_id] Does Not Exist On This Collection Instance

Are you sure the id of the table is called academic_id. By default, this field is called id and you can use your resource to rename it if you wish.

Dec
02
1 week ago
Activity icon

Awarded Best Reply on Get Sku Less Then 13 Digit

You need to use the full word here

SELECT * FROM `product_price_lists` WHERE LENGTH(sku) < 13

Documentation: https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_length

Activity icon

Replied to SOLID Design Principles And Data Manipluation

You can all methods to your Request class which can help you with that

class ValidateProduct extends FormRequest
{
    public function rules()
    {   
        return [
            'name' => 'required|min:3',
            'price' => 'sometimes|numeric',
        ];
    }

    public function price(): int
    {
        return $this->input('price') * 100;
    }
}

public function update(ValidateProduct $request, Product $product) 
{
    $data = $request->merge([
        'price' => $request->price()
    ]);
    
    $product->update($data);

    return redirect()->route('products.index');
}

You can also create a helper method that you can reuse. There are tons of options here ;)

Activity icon

Replied to How To Preview A Excel File Before Importing Into Database

It can be anyt hing in the foreach loop. Have you checked our storage/logs files?

Activity icon

Replied to How To Preview A Excel File Before Importing Into Database

You probably need to send the CSRF-Token along with the ajax request.

headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
Activity icon

Replied to HEROKU ERROR Oauth-public.key Doest Not Exist Or Is Not Readable

You need to run php artisan passport:keys on your server. You need to have a private and public key for passport on your server in the storage directory!

Activity icon

Replied to Date To Julian Format

I get the feeling that we're all googling for you, have tried googling this stuff yourself?