Relations Table Edit To Redirect?

I find myself when doing having relationships to be duplicating code for the table and the form inside the relation manager. Is there a way to have it in one place, the table for the relation manager should be the table for the resource and the Edit button instead of a modal should just redirect to the edit resource instead?
2 Replies
cheesegrits
cheesegrits15mo ago
Or you can just abstract the schemas to your own static class and just share the schemas themselves, rather than the whole $form and $table objects. So a class somewhere like ...
class FooSchemas
{
public static function makeFormSchema(): array
{
return [
// your schema here
];
}

public static function makeTableSchema(): array
{
return [
// your schema here
];
}
class FooSchemas
{
public static function makeFormSchema(): array
{
return [
// your schema here
];
}

public static function makeTableSchema(): array
{
return [
// your schema here
];
}
... then just call them wherever you make your form or table ...
return $table
->columns(FooSchemas::makeTableSchema)
//
return $table
->columns(FooSchemas::makeTableSchema)
//
Want results from more Discord servers?
Add your server