headlesslaravel / formations

MIT License
3 stars 5 forks source link

Imports: Add public and private key #53

Closed dillingham closed 2 years ago

dillingham commented 2 years ago
Field::make('product_line')
Field::make('product_line', 'productLine')

Lets replace this work around I added here with a internal key matching this section in filter.php.. the first parameter being the public facing key, in filters thats the url parameter, and the internal key being the relationship name.. sometimes they are the same but when the format is different.. the extra parameter is useful.

mitulgolakiya commented 2 years ago

@dillingham I was not properly able to understand this, but review this PR and share your thoughts if this is what we want?

https://github.com/headlesslaravel/formations/pull/66

dillingham commented 2 years ago

@mitulgolakiya basically it allows the developer to have a different format

Field::make('product_line', 'productLine')

means the import file can have product_line as the column header

but the model has a productLine() relationship


In filters we do the same thing.

Filter::make('is_not_paused', 'isActive')->scope()

means a public query string parameter is_not_paused will collect a value

and will be passed to isActive the scope method.

But without both parameters..

Filter::make('active')->scope()

This would be active the query string parameter and scopeActive() the method