jeffreyvanrossum

jeffreyvanrossum

PHP developer at vanrossum.dev

Member Since 3 Years Ago

Bennekom

Experience Points
30,740
Total
Experience

4,260 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
216
Lessons
Completed
Best Reply Awards
13
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 7
30,740 XP
Sep
17
2 days ago
Activity icon

Replied to Laracasts Text Editor - How Do I Replicate It?

@thebigk I get why it is the accepted answer (no problems with that at all), but honestly which markdown parser you use doesn't really change the principle of how it works.

And maybe I'm reading too much into this, but you specifically thanked Snapey for his reply (nothing wrong with that of course) but replied to me in a 'I obviously already know that' kind of way.

I'll leave it at that, just wanted to clarify. Happy you have your answer.

Activity icon

Replied to Guzzle/Http Client Error Method Patch

Looking at the error, it appears some required properties are missing. Just to be sure, your Postman request is working without errors?

Maybe you can try the following.

Instead of using 'json' => $body try 'body' => json_encode($body).

Activity icon

Replied to Guzzle/Http Client Error Method Patch

I think you can pass the array without encoding it.

Activity icon

Replied to Guzzle/Http Client Error Method Patch

Instead of passing your body variable to form_params try to use json. So 'json' => $body.

Activity icon

Replied to Laracasts Text Editor - How Do I Replicate It?

@thebigk It's funny that the accepted answer (from Jeffrey himself) turns out to be just pretty much the same as earlier answers. Yet you did not seem to take those seriously.

Sep
16
3 days ago
Activity icon

Replied to Laracasts Text Editor - How Do I Replicate It?

Are you referring to the comment form? I think it's a regular textarea where in you can type markdown. For the preview-toggle, with JavaScript, a AJAX request is made to an endpoint which generates the HTML resulting from the markdown.

On my personal site I use the Laravel Markdown package.

Activity icon

Replied to In What Language Should I Learn Data Structures And Algorithms ?

I personally would say: go with a language you are familiar and like working with. Since the principles of data structures and algorithms are not really limited to a specific language. I personally remember watching a lot of Derek Banas video's which are fast paced but pretty clear (his videos are mostly with Java).

Sep
15
4 days ago
Activity icon

Replied to Laracasts Tech Stack

What @automica said. And then, I presume, there is caching (limiting database queries for example) and using a (Cloudflare) CDN.

Sep
14
5 days ago
Activity icon

Replied to Open Source Laravel Projects For Learning?

I thought Laravel Cloud was interesting. It was a project from Taylor Otwell that he never finished (I believe due to work on Vapor). He open-sourced it, but not long after removed the repo. However, it was forked a lot of times so it's still around.

https://github.com/ChristopherDosin/laravel-cloud

Sep
11
1 week ago
Activity icon

Awarded Best Reply on Polymorphic Many-to-Many Relationship 'where' Clause On Table After Pivot

I think you can do a orWhereHas for the peekables part and then do a where user_id is equal to the current user's id.

As an example (not tested):

App\Post::where('visibility', 'public')
  ->orWhereHas('peekables', function($query) {
      $query->where('user_id', auth()->id());
  })
  ->paginate(5);
Activity icon

Replied to Polymorphic Many-to-Many Relationship 'where' Clause On Table After Pivot

I think you can do a orWhereHas for the peekables part and then do a where user_id is equal to the current user's id.

As an example (not tested):

App\Post::where('visibility', 'public')
  ->orWhereHas('peekables', function($query) {
      $query->where('user_id', auth()->id());
  })
  ->paginate(5);
Sep
08
1 week ago
Activity icon

Replied to [Jetstream][Teams] Customizing TeamController

I haven't used Jetstream yet, but I suppose you could alter the routes for Jetstream and then point to your custom controller which you could extend on the Jetstream TeamController.

I believe the routes are published to your routes folder.

Sep
07
1 week ago
Activity icon

Replied to Check For Duplicate When Updating Database

Your taking an OOP course but are using Eloquent already? If you are using Eloquent/Laravel I would advise to use the validation rules as suggested by @michaloravec. It would look something like this:

// On store
'name' => 'unique:products,name'

// On update
'name' => 'unique:products,name,id_to_ignore'

But it's up to you of course ;)

Sep
02
2 weeks ago
Activity icon

Replied to File Storage Outside Laravel Folder

I think you can, but you shouldn't use the storage_path helper in that case.

Aug
31
2 weeks ago
Activity icon

Replied to Change Db From OnetoMany To Manytomany

I guess you could create a migration for that which does the following:

  • Create a roles table and the pivot table
  • Populate your pivot table with the existing user_id and role_id relations
  • Drop the role column from your users table

But I'm curious to read how others would do this.

Aug
05
1 month ago
Activity icon

Replied to How To Get Daily Record And Sum Up

Do you mean the sales that have been made per date to represent total_sales? Or the amount that has been (in terms of money I guess) made in total?

If it's the first, I guess you can do a COUNT(id) instead of SUM(grand_total). You would have to have an id column on your orders table of course.

Activity icon

Replied to Query Builder With Join On Find_in_set

Not tested, but I think you can use $join->whereRaw (in your Closure) and pass your FIND_IN_SET there.

Aug
04
1 month ago
Activity icon

Replied to API Route Guest Access.

Just out of curiosity and slightly off-topic, but what is the value of adding namespace('\\')? That is the default, or am I missing something?

Aug
03
1 month ago
Activity icon

Replied to API Route Guest Access.

Just to clarify, you did edit your code sample after my response. The namespace value first was a back slash\, you've only just escaped it.

But yeah, that would probably have given you a invalid syntax error instead of a un-authenticated message.

Are you pointing to a controller where you are adding some middleware in the constructor perhaps? Or do you have any other active middleware registered in your app that might cause this behavior?

Activity icon

Replied to Polymorphic Pivot Table

I guess I would set up a likes table with the these columns:

  • user_id
  • likable_id
  • likable_type

Where likable_type would hold a value like for example 'App\Post` or 'App\Comment' point to the model that is liked. This makes it easily extendable to other models in the future too.

I wrote a blogpost that actually is pretty similar, but instead of likes is about bookmarks (but it is the same approach).

Activity icon

Replied to API Route Guest Access.

I think your namespace might be invalid. Maybe remove that part and try if it works.

Jul
31
1 month ago
Activity icon

Replied to Vue SPA With Laravel Authentication

When taking the SPA route, I guess it's more likely you would want to develop your front-end separately from your back-end entirely. In this case Vue being your front-end, and Laravel would be your back-end / API.

Jul
21
1 month ago
Activity icon

Replied to Laravel Disables Javascript Functionality

Have you checked the browser console for possible JS-errors?

Activity icon

Replied to Update Session Array

Once you have altered the array you would have to update the value in your session.

https://laravel.com/docs/7.x/session#storing-data

Jul
17
2 months ago
Activity icon

Replied to 419|page Expired Error When Trying To Login

Check the source code of the page in both incognito and normal and look for the csrf token meta field at the top of the page. Check if they are identical.

If they are, it might be cache related. Have you configured any form of caching?

Activity icon

Replied to EloquentModel::find(id)->with('relation')

Instead of get on your second snippet, you could use first instead.

User:where('id', 1)->with('some_relation')->first();
Activity icon

Replied to 419|page Expired Error When Trying To Login

Can you verify that the value of the csrf-token is different when you look at the page in an incognito window compared to a regular (non-incognito) window?

Activity icon

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

@s4muel I like contains, much cleaner to read. Can't believe I haven't known of that function before.

Activity icon

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

This issue lies within this part:

$blog->categories->id

$blog->categories will return a collection instance, so the id will not be an existing property. Since you are probably dealing with multiple categories, you could something like this:

{{ in_array($category->id, $blog->categories->pluck('id')->toArray()) ? 'selected' :null }}
Jul
16
2 months ago
Activity icon

Awarded Best Reply on Why Can't The Same Route Have Both GET And PUT Methods On A Linux Server?

I believe that by default PUT is not always allowed and you might have to edit the configuration. Some time ago I needed to add the PUT method on a server too.

Activity icon

Replied to Why Can't The Same Route Have Both GET And PUT Methods On A Linux Server?

I believe that by default PUT is not always allowed and you might have to edit the configuration. Some time ago I needed to add the PUT method on a server too.

Jul
15
2 months ago
Activity icon

Replied to Dropdowns In Vue

I guess you could make a custom dropdown component that has it's own open/closed state. Maybe this video can help you a little bit with that: https://tailwindcss.com/course/making-the-dropdown-interactive

Activity icon

Replied to Insert Multiple Id To Another Table

If you retrieve the ids as a comma seperated string, you would indeed use explode to turn it in to an array. (which you have commented out in your code)

$ids = explode(',', $request->ids);

foreach ($ids as $id) {
   IssuedUpload::create(['unit_id' => $id]);
}

Edit: what @michaloravec said

Activity icon

Awarded Best Reply on Nested Relationships

You would have to append [] to your newData variable, since it needs to be an array.

$newData[] = [
   'ar' => [
      'name' => $ar_name,
   ],
   'en' => [
      'name' => $en_name,
   ],
   'number' => $number
];
Activity icon

Replied to Laravel TDD - Attribute [store] Does Not Exist

Can you perhaps post the code so we can have a better look?

Activity icon

Replied to Nested Relationships

You would have to append [] to your newData variable, since it needs to be an array.

$newData[] = [
   'ar' => [
      'name' => $ar_name,
   ],
   'en' => [
      'name' => $en_name,
   ],
   'number' => $number
];
Jul
14
2 months ago
Activity icon

Awarded Best Reply on Inserting Row With Foriegn Key

Are you sure $request->house_id has a correct value?

Activity icon

Replied to Inserting Row With Foriegn Key

Just to be 100% sure, the 110 value is an existing id within your houses table?

Activity icon

Replied to Nested Relationships

In your data method you are using the *, which is fine for validation, but won't work when retrieving the data from the request.

Ideally, you would already structure the data coming from your request so that you don't need an additional data method to re-structure it.

But, as an example, to retrieve the services and restructure it anyway, you'll could use a foreach.

foreach( request('services') as $service ) {
   // do something with $services['ar_name'], $services['en_name'] etc.
}

Activity icon

Replied to Inserting Row With Foriegn Key

Are you sure $request->house_id has a correct value?

Activity icon

Replied to Update Vue Components In Larvel Forge

You don't need to run npm scripts normally on your production server. You do that locally and then push it to your production environment.

Your issue most likely has to do with caching. The changes are not visible because your assets might not be provided with a cache busting parameter.

Read more about that here: https://laravel.com/docs/7.x/mix#versioning-and-cache-busting

Activity icon

Replied to Do You Move Controller Methods To Models Or Not?

I do sometimes. For reasons that @tisuchi and @deepu07 mentioned. It makes the method easily re-usable at other places in your code and can clean up your controller.

Activity icon

Replied to Inserting Row With Foriegn Key

The associate method (https://laravel.com/docs/7.x/eloquent-relationships#updating-belongs-to-relationships) tries to set the foreign key on the child. But in your case, you need to set the house_id on your Tenant model.

You could do that like this:

$tenant->house_id = $house->id;
Jul
07
2 months ago
Activity icon

Replied to Laravel Validation Type Depending On Request ?

I guess the easiest way is to just make a seperate validation for your update request.

Activity icon

Replied to Composer Require Illuminate/support Gives An Erro Like "Your Requirements Could Not Be Resolved To An Installable Set Of Packages."

How come the package is missing in from your composer file in the first place?

You'll probably need other packages as well, check out the composer.json on Github for Laravel 6. Also notice the self.version usage which makes it easier te keep up-to-date.

Otherwise, to get this specific version for illuminate/support run:

composer require illuminate/support "6.18.0"
Jun
25
2 months ago
Activity icon

Replied to Forge And Envoyer Worth It?

I'm a happy Forge customer. I have made my own deployment scripts in the past, but Forge does just about everything for you. From setting up your server and making sure you have everything you need to run Laravel, to deployments (from Github).

I have no experience with Envoyer, but I can say that for me Forge is worth it.

Jun
19
3 months ago
Activity icon

Awarded Best Reply on Best Practice: Extends Vs. One-to-one Relationship

I would say that inheritance would make sense in this case. And if other attributes are needed for a specific child, you could implement that through a relation to keep the users table clean.

But I'm interested in what others think. Maybe it would depend on how you plan to interact with these entities?

Jun
13
3 months ago
Activity icon

Replied to Best Practice: Extends Vs. One-to-one Relationship

I would say that inheritance would make sense in this case. And if other attributes are needed for a specific child, you could implement that through a relation to keep the users table clean.

But I'm interested in what others think. Maybe it would depend on how you plan to interact with these entities?

May
26
3 months ago
Activity icon

Replied to Best Practice Using Queue On Shared Hosting

Thank you for your reply.

I basically followed this article to the letter: https://medium.com/@sdkcodes/using-laravel-queues-on-shared-hosting-a-simple-guide-9f976ccf99f3

I have not installed supervisor, but have seen mention of that being installable on shared hosting too. If they indeed fail I recon supervisor could then restart them automatically.