Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

jeffreyvanrossum

jeffreyvanrossum

PHP developer at vanrossum.dev

Member Since 4 Years Ago

Bennekom

Experience Points
32,720
Total
Experience

2,280 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
222
Lessons
Completed
Best Reply Awards
15
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
32,720 XP
Nov
24
23 hours ago
Activity icon

Replied to Converting Array To Xml

You can unset empty values from the array before you convert to XML.

You could use the array_filter function for that.

Nov
18
6 days ago
Activity icon

Replied to SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column ' Id' In 'where Clause' (SQL: Select Count(*) As Aggregate From `channels` Where ` Id` = 3)

The code you shared does not seem to be related to the error. Seems to be an issue with calling channels somewhere, a ChannelController perhaps?

Activity icon

Replied to BigSur?

Have been on using Big Sur for a while now (beta versions too), and no issues so far. The only thing I noticed was that the terminal in VSCode seems a little laggy. Other then that no issues. Using Laravel Valet for local development, VSCode and PhpStorm.

Activity icon

Replied to How To Iterate A Collection And Have Access To Preceding Item Within The Loop

Something like this perhaps?

collect([1,2,3])->each(function ($item, $key) use ($collection) {
    $previous = $collection[$key-1] ?? null;
    //
});
Activity icon

Replied to Navbar Already Disappear In Xl Size

Not 100% about this (not tested), but I guess you could set xl:hidden on the sidebar instead of lg:hidden.

https://github.com/tailwindcomponents/dashboard/blob/master/source/_layouts/sidebar.blade.php#L1

Nov
17
1 week ago
Activity icon

Awarded Best Reply on Search Multiple Columns As One

I think you can do a full text search if you are using MySQL.

https://www.w3resource.com/mysql/mysql-full-text-search-functions.php

You would have to alter your table to support it.

DB::statement('ALTER TABLE addresses ADD FULLTEXT fulltext_index (street, city, state)');

And to perform a where you do the following:

$query->whereRaw('MATCH (street, city, state) AGAINST (?)' , [$search]);

I have not tested the example code.

Activity icon

Replied to Search Multiple Columns As One

I think you can do a full text search if you are using MySQL.

https://www.w3resource.com/mysql/mysql-full-text-search-functions.php

You would have to alter your table to support it.

DB::statement('ALTER TABLE addresses ADD FULLTEXT fulltext_index (street, city, state)');

And to perform a where you do the following:

$query->whereRaw('MATCH (street, city, state) AGAINST (?)' , [$search]);

I have not tested the example code.

Nov
12
1 week ago
Activity icon

Replied to New Markdown Package For Laravel

Looks great @sinnbeck, might try it out soon. Thanks!

Sep
22
2 months ago
Activity icon

Awarded Best Reply on 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
21
2 months ago
Activity icon

Replied to Targeted Class Does Not Exist

Make sure you import the class at the top of the web.php file. Assuming you are using Laravel 8.

use App/Http/Controllers\AdminController

Or you can reference App/Http/Controllers\AdminController when you register the route.

Sep
17
2 months 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
2 months 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
2 months 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
2 months 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
2 months 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
2 months 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
2 months 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 months 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 months 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
3 months 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
3 months 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
3 months 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
3 months 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
4 months 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
4 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
4 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
4 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
4 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.
}