Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

heavyboots's avatar

heavyboots wrote a comment+100 XP

1mo ago

Laravel From Scratch (2026 Edition): Ep 25, Tailwind Theme Setup And Initial UI

Just a quick note that npm vite is the command if you don't have it in your paths. (Jeffrey uses just vite, which does nothing in Windows apparently.)

This will specifically fix if you're not seeing the black background/white text styles once he starts loading the site.

heavyboots's avatar

heavyboots liked a comment+100 XP

1mo ago

Laravel From Scratch (2026 Edition): Ep 25, Tailwind Theme Setup And Initial UI

Here are the full CSS component files for those looking to copy:

resources/css/components/btn.css

resources/css/components/form.css

heavyboots's avatar

heavyboots liked a comment+100 XP

1mo ago

Laravel From Scratch (2026 Edition): Ep 18, Authorization Using Policies

Hi @connor1231 ,

This is what is my cencept and I am open to discuss:

  • If we want to apply authorization rule to page level, we should use a gate and if we want to apply authorization rule to a model we should use policy.
  • As Jeffry had mentioned, gates are route closure equivalent of authorization and policies are controller equivalent of authorization for models.
  • If I do not want to display a page to an user, irrespective of whether the page is tied to any model or not, I will reach for gate. For example, an admin can view all ideas of all users. This page should be accessible by only admin.
  • If I want to restrict an user to update an idea created by another user, I will reach for policies. In this case, the update page is more specific to a model.

Regards, Anupam Bordoloi

heavyboots's avatar

heavyboots wrote a comment+100 XP

1mo ago

Laravel From Scratch (2026 Edition): Ep 18, Authorization Using Policies

@connor1231 I also agree that I was super muddy on why I would start out down one path or another (Gates vs Policies). Found this essay on the web to be useful. Also, towards the bottom, it has a specific paragraph related to this question.

https://www.twilio.com/en-us/blog/developers/community/what-are-laravel-policies-and-how-to-use-them-to-control-access

Here are some of the key comparisons between Gates and Policies:

  • Scope: Gates are designed for simple authorization scenarios, where only a single check is required to determine whether a user has access to a particular resource. On the other hand, Policies are designed for more complex authorization scenarios, where multiple rules may be required to determine whether a user has access to a resource.
  • Flexibility: Laravel Policies are generally more flexible than Gates, as they can be used to control access to any resource in a Laravel application, while Gates are typically used to control access to specific actions or routes.
  • Syntax: The syntax for defining Gates and Policies is slightly different. Gates are defined using a callback function, while Policies are defined as a separate class with specific methods for each action.
  • Granularity: Laravel Policies allow for finer-grained control over resource access, as they can be defined for specific models or model types. Gates are typically defined at the route or controller level, which may not provide the same level of granularity.
heavyboots's avatar

heavyboots wrote a comment+100 XP

1mo ago

Laravel From Scratch (2026 Edition): Ep 18, Authorization Using Policies

@cartman780 He changes the return type for the function in a lightning fast move with the keyboard mid-lecture at the start of where he sets it to return responses, lol. Basically at the top of the function change : bool to : Response.

heavyboots's avatar

heavyboots wrote a comment+100 XP

1mo ago

Laravel From Scratch (2026 Edition): Ep 15, Require Authentication With Middleware

I couldn't get Create New Idea to work until I added user_id to the $fillable list in the Idea model. Kept returning an error for user_id NOT NULL. I'm doing this in Laravel 13—no idea if that's related or not.

EDIT: Yeah, I think this is Laravel 13 related, because I remember I wasn't allowed to $guared = [] and had to use $fillable instead.

heavyboots's avatar

heavyboots wrote a comment+100 XP

1mo ago

Laravel From Scratch (2026 Edition): Ep 8, Databases, Migrations, and Eloquent

Something seems to have changed since this was created. You have to create the column nullable or php artisan migration returns an error:

"Cannot add a NOT NULL column with default volue NULL"

The fix for me:

$table->string('state')->nullable();

After that the migration works correctly.

EDIT: And $guarded = [] had to be replaced with $fillable = ['description', 'state'] too.

(Laravel 13 came out literally days ago, so I think maybe that's the issue?)