bobbybouwmann

bobbybouwmann

Developer at Enrise

Member Since 5 Years Ago

Apeldoorn, The Netherlands

Experience Points
1,650,075
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
1615
Lessons
Completed
Best Reply Awards
2128
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,650,075 XP
Feb
24
14 hours ago
Activity icon

Replied to Thermal Printer In A Webserver

Printers like that normally work through a local network or via a connection via some cable. You need to connect the printer to your server if you want to use it like that.

Activity icon

Replied to TokenMismatchException On EC2 Spot Instances?

The tokens are saved by default in the session which is saved on the server itself. You can easily update this the database, so you won't have this issue anymore

You can find more info here: https://laravel.com/docs/6.x/session#driver-prerequisites

Basically you need to run

php artisan session:table
php artisan migrate

And then update your .env to use database as the SESSION_DRIVER.

Feb
23
1 day ago
Activity icon

Awarded Best Reply on Is There Any Update For "Lets Build A Forum With Laravel And TDD"

Most things have stayed the same between releases. There might be some other names for things, but most of it is the same. At least, no features have been removed ;)

The series is still very relevant, even if you work with a newer framework version.

I bet Jeffrey will create a new series for Laravel 7 since that one has a lot of new features ;)

Activity icon

Replied to Laravel's Booking System - An Eternal Theme

I'm not sure what you mean by "secretive"...

It depends a bit on your system, but normally you just provide an array with available dates or you do an ajax call to check if the date is available or not.

Activity icon

Replied to RAW Select Is Not Included In Aggregate Pre-query

You can make this work using whereRaw, but I understand that you want to reuse the calculated field. I'm not sure if that is possible at all.

Did you try the raw query, so without Eloquent?

Activity icon

Awarded Best Reply on Factory Stub For Large JSON Body

I would probably just create a JSON file somewhere and do something like this

$data = json_decode(file_get_contents('data/json-data.json'));

You can set this data in your class and use it from there ;)

Activity icon

Replied to Laravel Groupby And Count Different Values (Polymorphic)

$reportables = Reportable::all();

$count = $reportable->groupBy(function ($reportable) {
    return $reportable->reportable_id . $reportable->reportable_type; 
})->count();

You can also use countBy to group them by a key and get the count per ke

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

Activity icon

Replied to Migrations (non Id Foreign Key)

You need to create a migration and tell which field should be the primary key

Schema::create('your-table-name', function (Blueprint $table) {
    $table->string('identifier');
    $table->string('column')->nullable();
    $table->timestamps();

    $table->primary('identifier'); // This set the primary key which makes it unique as well
});
Activity icon

Replied to Is There Any Update For "Lets Build A Forum With Laravel And TDD"

Most things have stayed the same between releases. There might be some other names for things, but most of it is the same. At least, no features have been removed ;)

The series is still very relevant, even if you work with a newer framework version.

I bet Jeffrey will create a new series for Laravel 7 since that one has a lot of new features ;)

Activity icon

Replied to Migrations (non Id Foreign Key)

Sure, why wouldn't it be possible ;)

Here is some more info on that: https://stackoverflow.com/questions/4813727/is-string-or-int-preferred-for-foreign-keys

Activity icon

Awarded Best Reply on Passport Getting 500 Internal Error

You can find the error in your storage/logs directory. Just a 500 error is also not understandable for us.

You say everything is configured correctly. Can you confirm that you have the private and public keys that are needed for passport?

Activity icon

Replied to Data Column Updated In New When Id Is Deleted From Another Table

So to be clear. Whenever you remove an image you also want the image_id set to empty in your articles table right?

This sounds like a foreign key constraint issue.

Activity icon

Replied to Passport Getting 500 Internal Error

You can find the error in your storage/logs directory. Just a 500 error is also not understandable for us.

You say everything is configured correctly. Can you confirm that you have the private and public keys that are needed for passport?

Activity icon

Awarded Best Reply on I Want To Add $input To $balance Value From A Different Table

You only post the project_id, you still need to fetch it

$product = Product::find($request->input('product_id'));

$balances = $product->product_n->balance;
Activity icon

Replied to InsertOrIgnore & Json Encode With Array Casting On Model

insertOrIgnore is basically bypassing the model methods and directly inserting a model into the database using a regular query. Where create and save also checks for mutators and casts.

If you want it to be JSON I would recommend you to use the normal way of creating a model using the firstOrCreate method which basically does the same thing. It creates it if it doesn't exist or fetches it when it exists.

Can you tell me why you use insertOrIgnore here?

Activity icon

Replied to Using The User Info In The Vendor Files

Yeah, you can fork the package, alter the migration, model, and code and then everything should work for you ;)

Activity icon

Replied to How To Image Upload Using Dropzone ?

Your form looks correct, but the URL in dropzone itself is incorrect. Can you post what you have now?

Activity icon

Replied to I Want To Add $input To $balance Value From A Different Table

You only post the project_id, you still need to fetch it

$product = Product::find($request->input('product_id'));

$balances = $product->product_n->balance;
Activity icon

Replied to Data Column Updated In New When Id Is Deleted From Another Table

I really don't understand your question..

Activity icon

Replied to Using The User Info In The Vendor Files

First of all, editing the vendor files is not a good idea. If you run composer update your changes are gone as well! In general, it's better to improve the package by sending in a pull request that add the functionality for the user_id.

Anyway, it seems that the packages don't store any user_id so you won't be able to access it. It also has a fixed table, so it seems that you won't be able to store the user_id because there is no column for it.

What package are you using?

I would personally use another package like https://github.com/spatie/laravel-activitylog

Activity icon

Replied to How To Image Upload Using Dropzone ?

What have you tried? It seems that you just copied this from somewhere and use that so far...

Here is a tutorial you can follow for Laravel: https://www.itsolutionstuff.com/post/laravel-6-dropzone-image-upload-tutorialexample.html

Activity icon

Replied to Laravel Airlock Filtering Data For Auth And Guest In Same Route

The middleware is only there to set a certain airlock attribute. If that is not there, you're not logged in.If you remove the middleware everyone can access the route.

Then in your controller you can decide what to fetch

if (auth('airlock')->check()) {
    $videos = $this->getPremiumVideos();
} else {
    $videos = $this->getFreeVideos();
}

This should work ;)

Activity icon

Awarded Best Reply on Override Authentication Flow Laravel

AuthenticatesUsers is a trait. All methods of the trait are copied to the class, in this case, the controller. However, you can override the methods from the traits in your class.

So if you want to override the showLoginForm method, you can do something like this

namespace App\Http\Controllers\Auth;

use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
    use AuthenticatesUsers;

    public function showLoginForm()
    {
        // You can do here whatever you want because you override the method.
    }
}

This works for all methods in the AuthenticatesUsers trait.

Activity icon

Awarded Best Reply on Undefined Method Links

It seems that you're using the pagination functionality in your view. However, the packages relationship is not a pagination object.

You have two options here. Either removing the {{ $packages->links() }} call because you don't want to use pagination. Or make the relationship a paginated object

return view('message.index')->with('messages', $user->messages()->paginate());
Activity icon

Replied to Laravel Twitter Access Token

Laravel Socialite is built for this. This way you get a token from the user and you can use that to verify the user against Twitter. In general, you should retrieve the token using socialite and it shouldn't be posted to you.

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

Activity icon

Replied to New To Queues! What Does Everything Mean?

A few months ago someone asked this as well! The best reply from there should put you in the right direction

Thread: https://laracasts.com/discuss/channels/laravel/what-is-queue-connection-name-and-what-is-the-use-of-queue-name-connection

Activity icon

Awarded Best Reply on Array To Xml

I can highly recommend you to use this package: https://github.com/spatie/array-to-xml

Activity icon

Awarded Best Reply on Collection Retrieve Data Like Array Of Object?

You can use the get method of the collection for this

$value = $collection->get('item');

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

Activity icon

Replied to Laravel Redirect Failing CORS?

But you're running it through InertiaJS which is doing an ajax post request for you in the browser whenever you click on the button. Because of that, you're not allowed to just go to another website.

Activity icon

Replied to ErrorException (E_WARNING) Attempt To Assign Property 'mime' Of Non-object

Can you post the full exception here? It should say which line is failing.

Anyway, I think the error is in here:

$mimetype = $image->getClientMimeType(); //Get MIME type

You only create this property in the iff statement. If you get past the if statement without creating the variable, updating the picture won't work as well.

Instead, you need to do this

$data = mediaLibrary::findOrFail($id);

if ($request->hasFile('image')) {
    if ($request->file('image')->isValid()) {
        $image = $request->file('image');
        $extension = $image->getClientOriginalExtension();//Getting extension
        $originalname = $image->getClientOriginalName();//Getting original name

        if(file_exists($data->filename)) {
            unlink($data->filename);
        }
                        
        $path = $image->move('uploads/media/mainMedia/', $originalname);
        $imgsizes = $path->getSize();
        $data = getimagesize($path);
        $width = $data[0]; 
        $height = $data[1];
        $mimetype = $image->getClientMimeType();//Get MIME type

        $data->mime = $mimetype;
        $data->imgsize = $imgsizes;
        $data->original_filename = $originalname;
        $data->extension = $extension;
        $data->width = $width;
        $data->height = $height;
        $data->filename = $path;

        $data->save();
    }
}

Do you see and understand the difference? The property are now always available. In your example this is not the case!

Activity icon

Replied to Collection Retrieve Data Like Array Of Object?

You can use the get method of the collection for this

$value = $collection->get('item');

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

Activity icon

Replied to Laravel Redirect Failing CORS?

From where do you call the Redirect::away call in your controller. It sounds to me that you're doing this in your frontend. However, your frontend is not allowed to redirect you. Instead, you need to send the payment url to the frontend and replace the URL or open it in a new tab. A redirect won't work here.

redirect()->to($payment->getRedirectUrl()) should work as well ;) (At leas that is what I use with Mollie)

Activity icon

Awarded Best Reply on Swift_RfcComplianceException

This really is an annoying issue, believe me!

Normally you get this message when there is a , or in your email address which makes it invalid. Those email addresses normally pass the email validation but are not correct for Swift_Message that sends the email.

So my advice would be checking if the email contains any character that seems wrong like a comma or a space.

Activity icon

Replied to Swift_RfcComplianceException

This really is an annoying issue, believe me!

Normally you get this message when there is a , or in your email address which makes it invalid. Those email addresses normally pass the email validation but are not correct for Swift_Message that sends the email.

So my advice would be checking if the email contains any character that seems wrong like a comma or a space.

Activity icon

Replied to Undefined Method Links

It seems that you're using the pagination functionality in your view. However, the packages relationship is not a pagination object.

You have two options here. Either removing the {{ $packages->links() }} call because you don't want to use pagination. Or make the relationship a paginated object

return view('message.index')->with('messages', $user->messages()->paginate());
Activity icon

Replied to Override Authentication Flow Laravel

AuthenticatesUsers is a trait. All methods of the trait are copied to the class, in this case, the controller. However, you can override the methods from the traits in your class.

So if you want to override the showLoginForm method, you can do something like this

namespace App\Http\Controllers\Auth;

use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
    use AuthenticatesUsers;

    public function showLoginForm()
    {
        // You can do here whatever you want because you override the method.
    }
}

This works for all methods in the AuthenticatesUsers trait.

Activity icon

Replied to Array To Xml

I can highly recommend you to use this package: https://github.com/spatie/array-to-xml

Feb
22
2 days ago
Activity icon

Replied to Laravel 5.4 API Tokens

This is a basic one-to-many relationship, right? You create multiple tokens in the database that are connected to the user. For authentication, you just check if the token exists and you know what user is logged in.

Activity icon

Replied to Response With Status Code Is Failing.

That doesn't make any sense to me. It's working fine for me at least. Do you have a like a middleware that is alternating the response?

Activity icon

Replied to Factory Stub For Large JSON Body

@booni3 Yeah, that is the way to go. To be sure, you can build in a check if the exists or not. For the rest, this looks pretty good ;)

Activity icon

Replied to Laravel Groupby And Count Different Values (Polymorphic)

I would probably just fetch all records and use the collection methods to get the correct count and groups ;)

Activity icon

Awarded Best Reply on Imagick Laravel Local Environment

You need to run some commands in your command line to get it all up and running. I find this a very good video to follow: https://www.youtube.com/watch?v=nxBmmcCjbho

Let me know if you have any trouble

Activity icon

Awarded Best Reply on I Need To Check One-to-one Relationship

If you use the correct relationship you can check against it using the exists method

$user->profile()->exists(); // true or false
Activity icon

Awarded Best Reply on Generating PDF Not Working

It seems that the path is incorrect. You need to point to where you stored the file. If this is the public directory use this

$pdf->setSourceFile(public_path('/pdfs/example.pdf'));

If you stored it in the storage directory use this instead

$pdf->setSourceFile(storage_path('/pdfs/example.pdf'));

Well, you get the idea ;)

Feb
21
3 days ago
Activity icon

Awarded Best Reply on Laravel Server Requirements For A Website.

Yeah this is fine in 90% of the cases. You might need to upgrade the server if you get a lot of traffic or if the application is doing a lot of stuff on the background. But this should be fine to start with for sure ;)

Activity icon

Awarded Best Reply on Customer Verification View - Logic

Well, that is correct, because after clicking the button you are verified and redirected to the home page. Or in your case the dashboard. The verified page itself doesn't exist by default.

If you want to redirect to another page, you need to override the show method of the app/Http/Controllers/Auth/VerificationController.php controller. Something like this

class VerificationController extends Controller
{
    use VerifiesEmails;

    protected $redirectTo = RouteServiceProvider::HOME;

    public function __construct()
    {
        $this->middleware('auth');
        $this->middleware('signed')->only('verify');
        $this->middleware('throttle:6,1')->only('verify', 'resend');
    }

  public function show()
  {
     // return your view here
  }
}
Activity icon

Replied to Generating PDF Not Working

It seems that the path is incorrect. You need to point to where you stored the file. If this is the public directory use this

$pdf->setSourceFile(public_path('/pdfs/example.pdf'));

If you stored it in the storage directory use this instead

$pdf->setSourceFile(storage_path('/pdfs/example.pdf'));

Well, you get the idea ;)

Activity icon

Replied to I Need To Check One-to-one Relationship

If you use the correct relationship you can check against it using the exists method

$user->profile()->exists(); // true or false
Activity icon

Replied to Response With Status Code Is Failing.

Have you tried a different status code to see if that works? 409 is a really specific code that the resource is busy and is not used often.