-
-
Notifications
You must be signed in to change notification settings - Fork 376
Allow for custom "shops" table for automatic migrations #1192
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good update, comments inside about a way to clean things up.
Can re-review after.
@osiset, I have already rewritten the code based on your change request. Please review the PR again. Thank you |
@nahid I am fine at a quick glance except for the fact that the table function is doing more than one thing. It is named or... return an array or object for Something like: // Method A
public static function getShopsTable(): array
{
$shopTable = Util::getShopifyConfig('table_names.shops') ?? 'users';
$foreignId = Str::singular($shopTable) . '_id';
return ['table' => $shopTable, 'foreign' => $foreignId];
}
// or .... Method B
public static function getShopsTable(): array
{
$shopTable = Util::getShopifyConfig('table_names.shops') ?? 'users';
$foreignId = Str::singular($shopTable) . '_id';
return [$shopTable, $foreignId];
} Usage could be something like: $table = Util::getShopsTable()["table"];
// or ... Method B
list($table) = Util::getShopsTable();
// or ... Method B
$table = Util::getShopsTable()[0]; Or, if that feels messy, then split into two functions. |
I think different method for each functionality will added more readability and developer experience as well. Util::getShopsTabel(): string
Util::getShopsTableForeignKey(): string |
@nahid I agree. Go ahead with it :) |
@osiset, I have pushed the following changes, Please review again |
Solid. I'll approve letting Actions run and we'll see what happens. Probably will need test added to Until tests to ensure coverage is there. |
Maybe |
@nahid Tests pass, coverage didnt change as well, so thats OK. |
@osiset, I just pushed another commit with fixes, please check |
@nahid Still is failing the lint. Locally, you can |
@osiset please check the latest commits |
@nahid Please review once more, and if you're good we'll merge this in. |
@osiset sure |
laravel-shopify allowing custom auth guard in their latest version. But it not support to allowing migration with custom table for shops in automatic migration.
This PR is allowing developer's to set their own shops table in config to execute migration with given name.