bobbybouwmann

bobbybouwmann

Developer at Enrise

Member Since 5 Years Ago

Apeldoorn, The Netherlands

Experience Points
1,522,585
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
1557
Lessons
Completed
Best Reply Awards
1935
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,522,585 XP
Oct
17
4 hours ago
Activity icon

Replied to Disable Unused Variable Error

I'm not an expert in this, but this should be the correct setup for this AFAIK.

Activity icon

Replied to Extending Package.json Within Laravel Package

In general, when you have a package that includes javasript you don't do anything with the javascript yourself as the end-user. The creator package builds the JS and minimizes it and that file is included in the package and loaded.

So I'm wondering what your use case is here with the Vue stuff that you need to add?

Activity icon

Replied to Disable Unused Variable Error

Your syntax is correct, but I think you use the wrong rule here. Shouldn't it be just no-unused-vars, without the vue part.

rules: 
    'no-unused-vars': 'off'
},
Oct
16
1 day ago
Activity icon

Replied to Trouble Using External Filesystem W/ Laravel (AWS-compatible One)

I think Laravel can't handle the wasabi driver here. Instead, it's better to use a package that supports the wasabi driver for Laravel: https://packagist.org/packages/probablyrational/wasabi-storage

Let me know if that works for you!

Activity icon

Replied to Laravel Queue Job Manually Run Without Php Artisan Queue:work Command To Send Email

Normally you have a tool like supervisor that keeps running your php artisan queue:work command. This way you don't have to call it yourself. For local development this isn't a good solution, you normally only do this on your server.

For local development I recommend you to set the driver to sync so the job is fired right away.

You can find more in the docs about this. It also mentions supervisor

Documentation:https://laravel.com/docs/6.x/queues#running-the-queue-worker

Activity icon

Replied to Passport

What do you think the tables are for?

Anyway, I recommend you to read the full passport documentation and then most tables will already make sense

Documentation: https://laravel.com/docs/6.x/passport

If you're still not sure how things work I would recommend you to read the documentation of the underlying league/oauth2-server package

Package: https://oauth2.thephpleague.com/

Activity icon

Replied to Validation In Laravel

I think your regex need to look like this

[-\d+*\/]

You can test it here: https://regex101.com/r/0jIYwc/1

Activity icon

Replied to Looking For A Admin Theme For An ERP Project.

@muhammadjaved I think all of these themes look pretty good. You just need to look into what they offer extra and what component you think you need ;)

Oct
15
2 days ago
Activity icon

Replied to Should Money Be Paid For Laravel?

Laravel is an open source framework. Which basically means it's completely free to use ;)

You might need to pay for the tooling around Laravel. For example, services like Laravel Forge or Laravel Nova. The framework and the usage of the framework itself is completely free.

Activity icon

Replied to What's Wrong With My Middleware?

No problem ;) It's awesome to help other people :D

Mmh your middleware should at least be called after the middleware that creates the session.

So how do you apply this specific middleware to your routes? In a group or only on a specific route?

Activity icon

Replied to Get Children On Custom Component

If you give your children a reference you should be able to get information from them. Here is an example: https://stackoverflow.com/questions/42814406/accessing-nested-child-components-in-vuejs

Activity icon

Replied to Messaging Like Facebook

Probably one channel is already good enough for all the notifications for a specific user. You could consider adding an extra channel for each chat as well so you can show results in there as well. However, one channel should be good enough.

Activity icon

Replied to How To Create Fake Blog Content With Html Code And Not Real Text In Faker

If htmlLorem is not doing what you want, then they're not much alternatives.

An option is to remove all tags from the generated htmlLorem text and use that.

Personally I would generate some HTML files and use file_get_contents to randomly pick one of those files and pass them to your model in the factory. This way you get your custom HTML and it can still be randomlyish.

Activity icon

Replied to Scaling Laravel Scout

Well, you can't share it without moving it to its own server. It's really hard to keep all servers in sync based on the given data. Keeping your servers in sync with all the data in a completely different challenge if you ask me!

So your best option is to store it on a separated server using a certain storage driver. I believe you can configure a storage driver, so that should actually work.

Activity icon

Replied to Add Value

Your component doesn't know the user object, so this.user is never going to work. Instead, you can set the global object in the window and then you should be able to access it.

window.user = [YOUR OBJECT HERE]

// Selec the customer_id
windows.user.customer_id

Note that this is not a good practice. If you want to share data between component you either need to pass the data to those components or use something like vuex to share a certain state!

Activity icon

Replied to What's Wrong With My Middleware?

I don't see much strange things here. However, I did notice that you use Cache::get('currencies') everywhere. What happens if that doesn't return anything. At this point it will never set any value.

I would expect something like this

$currencies = Cache::remember('currencies', 60 * 60 * 24, function () {
    Currency::updateExchangeRates();

    return Currency::where('is_active', '1')->get();
});

if (!$request->session()->has('preferred_currency')) {
    $currency = $currencies->where('is_active', '1')->where('code', $geoCurrencyCode)->first();

    if (!$currency instanceof Currency) {
        $currency = $currencies->where('code', 'USD')->first();
    }

    if ($currency instanceof Currency) {
        session(['preferred_currency' => $currency]);
    }
}

return $next($request);

Well you get the idea ;) Let me know if this makes sense to you.

Activity icon

Replied to Storage

@davy_yg Well no, normally this is an incoming string from a form or the contents of an image. For example

Storage::put('file.jpg', Storage::get('file2.jpg'));

This is basically copying an image. Bu Storage::get returns the string representation of that image. You can try that out yourself :)

Activity icon

Replied to Storage

You won't enter your own text in there and convert it to an image. That doesn't make any sense.

However, HTTP can only send text over the line and not actual images. So that's why there is a conversion from image to text and then from text to image.

Activity icon

Replied to AssertContains() Url: Testing Best Practice

Yeah, of course, that should have been double quotes :see_no_evil:

Activity icon

Replied to Scaling Laravel Scout

Well, that is very challenging. When scaling your application you need to keep a few things in mind. Your data need to be accessible from different servers or locations. For example, your database can't run on one server anymore, it's better if it runs on its own server so you easily access it. The same goes for the storage of your indexes. You need a setup that works like Algolia or ElasticSearch where you store your indexes on a different server and you can access it there from all the other servers.

So in this case you need to centralize the data of your indexes to make it work in a scalable setup.

Activity icon

Replied to Composer Command

The command regenerates the list of all classes that need to be included in the project (autoload_classmap.php).

In Laravel the autoload_classmap.php also includes the providers in config/app.php. So when run this command your providers are being registered again.

Activity icon

Replied to New Laravel

It's probably because of your current PHP version. I bet you're still running on PHP 7.1 locally. However, Laravel 5,8 and 6.x require you to use PHP 7.2 or higher. If you update your PHP version it should update the latest version of the framework for you ;)

Activity icon

Replied to Data Format Issue In Mysql

Well, before you insert it in the database you need to convert it so it's in the correct format. You can do the conversion yourself in either the frontend using momentjs or using Carbon in your PHP backend.

Using Carbon it will be handled automatically for you:

$date = Carbon::createFromFormat('dd/mm/yyyy', $date);
Activity icon

Replied to Storage

Well, an image is actually text. If you would open an image in an editor you would only see text characters and special characters. This is based on the type of image you have of course.

Whenever you upload a file it's being sent as text as well over the line.

Take a look at these examples: https://www.php.net/manual/en/function.imagecreatefromstring.php

Oct
14
3 days ago
Activity icon

Replied to How To XML Data Convert To Php Object

Well, look at the error... Your data is an array and not a string. Also looking at your data it looks more like XML in JSON...

Can you show your code for this?

Activity icon

Replied to How To XML Data Convert To Php Object

You can use the simplexml_load_string method for that

Documentation: https://www.php.net/manual/en/function.simplexml-load-string.php

Activity icon

Replied to Laravel Fixed Next Version?

This depends on the MySQL database version you're using. Also from the same article:

This only affects new applications and as long as you are running MySQL v5.7.7 and higher you do not need to do anything.

Sadly, if you're running MariaDB you need to keep fixing this.

Activity icon

Replied to Is This Coding Correct?

This bit is not really efficient

$items = registermodel::all()->filter(function($record) use($email) {
    if(($record->email) == $email) {
        return $record;
    }
});

You're fetching all records here and then start filtering. Instead, you can already do that in the query

$items = registermodel::where('email', $email)->get();

Also instead of fetch all records you only need to fetch the first record and use that for checking. This way you don't have to loop over the items anymore

$registermodel = registermodel::where('email', $email)->first();

if (!$registermodel instanceof registermodel) {
    return redirect()->back()->with('error','Invalid Email_id');
}

if (Auth::attempt(['id' => $id, 'password' => $password])) {
    $request->session()->put('Email_id', $email);

    return Redirect::to('View/records');
}

return redirect()->back()->with('error','Credentials does not match');

Note that this uses "early returns". Let me know if this works for you as well ;)

Activity icon

Replied to Mysql Multiple Update?

Well if the id is not 1 then it will clear it because the case condition will return null. There is no match for Alex in there.

However, your update can be done much easier right?

update names set name = 'michael' where id = 1;
Activity icon

Replied to Laravel Image Upload Not Working

The part of parsing the multiple images works fine! However, you're overriding the $filename variable in the look an, therefore, it only saves one image. Try this instead

if ($request->hasfile('image')) {
    foreach($request->file('image') as $image) {
        $filename = time().'.'.$image->extension();
        $location = public_path('image/'.$filename);

        Image::make($image)->resize(800, 400)->save($location);

        // Save the image here instead of later

        $news->image = $filename;
        $news->save();
    }
}

return redirect()->route('news.index');

Note that this won't work as well, because you upload multiple images. Your model only accepts one image. So instead you need a one-to-many relationship here to connect each image.

Documentation: https://laravel.com/docs/6.x/eloquent-relationships#one-to-many

The relationship is not required, but in general, a better approach than the tutorial you've been following: https://appdividend.com/2018/02/05/laravel-multiple-images-upload-tutorial/ This should work as the tutorial suggested.

Activity icon

Replied to Submit Button Not Function

Are you sure your validation is not failing here? You can test that by doing this in your view

{{ dump($errors) }}

This way you can see after submitting the form if you're redirected back to the form.

And also are you sure your session is working properly? If the form does submit you show an alert, but if that is never loaded, you won't see anything at all.

Oct
13
4 days ago
Activity icon

Replied to Terrible Vue Performances

First of all the first response of the server is really slow. It's between 2 and 3 seconds... That is really bad for a homepage. You might need to look at getting a faster server or deciding on what to load on the homepage right away and whatnot.

Looking at the site I see a lot of dynamic components. They seem to take a while to all be loaded. Maybe adding some caching to the query itself will speed things up as well.

Anyway, the Vue part. As long as you run npm run prod you should be good! Your file is medium-sized, so your browser should be able to handle it pretty quickly. Then we come back to the slow server that should return results faster as well!

Activity icon

Replied to Autodiscovery Not Working For Tests

Make sure your phpunit.xml, tests/TestCase.php and tests/CreatesApplication.php files are in sync with the Laravel version you use. It could be a small configuration problem.

Anyway, I would need more information to help you out!

Activity icon

Replied to How To Handle Events And Jobs That Do The Same Thing?

Well, they already live in a different namespace right? So you could use that to your advantage and use the full namespace in your code. However, you will get huge namespace and that's also not something you want for readability.

I would personally suffix my listeners with Listener and keep the jobs as normal classes, so without the suffix.

You can also think about moving the logic from the job to the listener if that makes sense. Unless you use the job in other places as well.

Activity icon

Replied to How To Sort By A Custom Appended Relation To Model

You can probably add the field for sorting and filtering using the dot-notation

->allowedFilters([
    'cheapestroom.sales_price',

    // Your filters here
]);

Documentation: https://docs.spatie.be/laravel-query-builder/v2/features/filtering/#exact-or-partial-filters-for-related-properties

Activity icon

Replied to How To Paginate Nested Comments...

Well, you first need to decide how your comments are going to work. In general, you need to fetch for example the last 15 comments. Then for all of these comments, you need to fetch their children and their children and so.

So basically you need a recursive relationship here! This might help you with that: https://stackoverflow.com/questions/26652611/laravel-recursive-relationships

Activity icon

Replied to Using Wasabi For Backup

I would probably make a custom driver for this! However, there already is a package available for this: https://packagist.org/packages/probablyrational/wasabi-storage

Activity icon

Replied to Testing MorphOne Return Null In "assertInstanceOf"

Yeah, you need to make sure you actually store the data. Otherwise the relationship won't return anything!

Activity icon

Replied to How To Display Tasks By Date Created In Pagination?

The query looks good to me. In your view, you need to do something like this

@foreach ($tasks as $date =>  $groupedTasks)

    {{ $date }}

    @foreach ($groupedTasks as $task)
        // Display task here
    @endforeach

@endforeach

Note that the value you return in the groupBy callback will be the value of the date key

Documentation: https://laravel.com/docs/6.x/collections#method-groupby

Activity icon

Replied to AssertContains() Url: Testing Best Practice

This should work for you

$url = 'http://bidbird.test/invitations/{$mail->invitation->invitation_code}';

$this->assertContains('TESTCODE1234', $url);

As an alternative you can use a regex check for the given string

$this->assertRegexp('/TESTCODE1234/', $url);
Activity icon

Replied to Testing MorphOne Return Null In "assertInstanceOf"

Are you sure you're creating the relationship in the test? Can you show your full test?

Oct
12
5 days ago
Activity icon

Replied to Testing MorphOne Return Null In "assertInstanceOf"

Are you sure the relation actually exists? Otherwise, it returns null!

Activity icon

Replied to Testing MorphOne Return Null In "assertInstanceOf"

So the relationship using ->image() works a bit different because it returns a Query Builder object. That's why it works correctly.

For example if this fails, the other example should also fail

// If this fails
$this->assertInstanceOf(Image::class, $topic->image);

// This should also fail
$this->assertInstanceOf(Image::class, $topic->image()->first());

Sometimes you can also refresh the model to make sure it's in the correct state when testing

$topic = $topic->fresh();

$this->assertInstanceOf(Image::class, $topic->image);
Activity icon

Replied to Passport For A Package

I would probably offer both options. So the end-user can decide which version to use. You can probably just solve that with a simple config ;)

Oct
11
6 days ago
Activity icon

Replied to Nova Hashids

Are you looking for something like this? https://novapackages.com/packages/pmochine/laravel-nova-hashids

Activity icon

Replied to Sales , Commision, Tax Analysis

You can do it with any language or tool. In this case, it depends on what you already know and with what language or library you feel comfortable.

The sky is the limit ;)