colincameron
colincameron

Colin Cameron

@colincameron

Freelance software developer at amplifycode.com

12 Posts 28 Views

  • No matching results...
  • Searching...

/ 255

Looking at the PingCRM example Inertia repo. What is `through()` here? github.com/inertiajs/pingcrm/blob/0a798fadc87dc1cf22933bb1224c834df53579f5/app/Http/Controllers/OrganizationsController.php#L24



I can't find a reference in the Laravel or Inertia docs. Is it just a way of mapping the objects to an array? If so, what's the advantage over `only()`?

131

With Inertia+Vue, what's the best way to make authenticated API requests from within an Inertia component?

Should I use Sanctum and pass the token in HandleInertiaRequests, or should I use the web auth guard for my API endpoints so they are authenticated by the user's session?

1

776

Laravel validation tip (as I've just run into this):

'required_if' requires 'nullable' if you have additional rules.

e.g. 'registration_opens_at' => 'required_if:type,1|nullable|date|after_or_equal:today',

Without nullable, the date and after_or_equal rules were failing even if the 'type' field wasn't 1.

154

I have a multi-tenant application, with users and teams. Currently the only permissions I use are an is_admin flag on the user, and a team_admin flag on the user-team relationship.

I want to add more fine-grained permissions, granting specific actions per team, and overall for the organisation. For example, “send_emails”, “add_users”, or “team.{id}.add_users”, “team.{id}.update_event”.

Best in mind these permissions are scoped per organisation, and a user can be in multiple organisations.

Would any of the permissions/roles packages suit this well or should I just roll my own? I’m leaning more towards DIY at the moment.

1

118

Is the Pinkary markup syntax documented anywhere?

I assume it's just a subset of Markdown

1

106

Thanks I figured it would be.

BTW I assume you replied, deleted, then replied again. I got a 403 when clicking the first notification.

148