Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple base connection #64

Open
ghost opened this issue Sep 12, 2022 · 1 comment
Open

Multiple base connection #64

ghost opened this issue Sep 12, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 12, 2022

Is there a way of having multiple base connection like :
'base' => [
'base1' => env('AIRTABLE_BASEID1'),
'base2' => env('AIRTABLE_BASEID2'),
...
],

And so, directly from this previous connection, picking table name like this :
Airtable::table('TableName')->get();

Bc if i have like 5 base with 20 tables in each i would have to hard write 100 table connection in airtable.php like this :
'tables' => [
'Table1FromBase1' => [
'name' => 'Table1_name',
'base' => 'baseid1'
],
... (x100)
],

Or am i missing something ?

@ghost
Copy link
Author

ghost commented Sep 13, 2022

I have found an alternative solution tho, You can put something like this in the top of airtable.php before the return :
$tables = [
'TableName1',
'TableName2'
...
];
$basekey = [
"BaseNamePrefix1" => "basekey1",
"BaseNamePrefix2" => "basekey2"
];

$airtableTables = [];

foreach ($basekey as $key => $value) {
foreach ($tables as $k => $v) {
$airtableTables[$key . '_' . $v] = [
'name' => $v,
'base' => $value
];
}
}

And in the return "Default Airtable Table" section :
'tables' => $airtableTables,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants