TappNetwork/laravel-airtable

Table not configured?

Helmi opened this issue · 2 comments

Helmi commented

Hey @swilla,

first of all thanks for the package. I'm quite new to Laravel but i have used the Airtable API already. So I thought I'll give it a try even though the documentation is a bit sparse at the moment.

Unfortunately I'm having a hard time getting started.

        $test = Airtable::table('Customers')->get();
        ddd($test);

Here's a simple thing I'm trying. Base ID and Key are in the config. I'm getting an error complaining about the Customers table not being configured. I was already confused why you would configure a table, I did configure one though but that didn't change anything.

I'm also not sure why your inline documentation in config.php points to API doc information about tables. Usually the API takes the name of the table so I'm not sure what information about tables I should pull from the API docs.

Sidenote: I'm quite sure my data (API Key, Basekey) is correct as I'm using the same from a pythong script using https://github.com/gtalarico/airtable-python-wrapper

Maybe you can help me get started - I'm sure I'm just missing something.

Thank you

@Helmi I agree that we need to step up our documentation game. There is a config file that you can publish that will allow you to setup multiple tables. If you want to use Airtable::table('Customers'), you will need to add that table to the config file.

For example:

'tables' => [

        'default' => [
            'name' => env('AIRTABLE_TABLE', 'Main'),
        ],

        'companies' => [
            'name' => env('AIRTABLE_CONTACTS_TABLE', 'Companies'),
        ],

        'contacts' => [
            'name' => env('AIRTABLE_CONTACTS_TABLE', 'Contacts'),
        ],
],