abordolo's avatar

abordolo liked a comment+100 XP

2mos ago

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

resources/css/components/btn.css

resources/css/components/form.css

abordolo's avatar

abordolo liked a comment+100 XP

2mos ago

Color theme for those looking to copy:

    --color-background: oklch(0.12 0 0);
    --color-foreground: oklch(0.95 0 0);
    --color-card: oklch(0.16 0 0);
    --color-primary: oklch(0.65 0.15 160);
    --color-primary-foreground: oklch(0.12 0 0);
    --color-border: oklch(0.24 0 0);
    --color-input: oklch(0.24 0 0);
    --color-muted-foreground: oklch(0.6 0 0);
abordolo's avatar

abordolo wrote a comment+100 XP

2mos ago

And in the controller if we are using authorize method with one parameter, we are using gate:

Gate::authorize(parameter1);

// ex.
Gate::authorize(gateName);

If we are using authorize method with 2 parameters, we are using policies:

Gate::authorize(parameter1, parameter2);

// ex.
Gate::authorize(methodName, modelOrClassInstance);
abordolo's avatar

abordolo wrote a comment+100 XP

2mos ago

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

abordolo's avatar

abordolo wrote a comment+100 XP

3mos ago

Blade prop

Hi @jeffry, in the error component, I think, following code gives a default value of 'required' to $name and not make it mandatory like in Vue prop.

@props([
    'name' => 'required',
])