TappNetwork/laravel-airtable

Table is not configured.

dylanmichaelryan opened this issue · 7 comments

Error Code
Table [Gesamtportfolio] is not configured.

.env
AIRTABLE_TABLE=Gesamtportfolio

Controller
return Airtable::table('Gesamtportfolio')->get();

Screenshot attached from airtable, where you can see the table name
vFGCFQL

What am i doing wrong?

Since that table is configured as the default table you do not need to specify the table.
https://github.com/TappNetwork/laravel-airtable/blob/master/config/config.php#L45

You can modify your configuration to include the tables you want to use:

    'tables' => [

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

        'contacts' => [
            'name' => 'Contacts',
        ],
...

Even if i not specify the table i get this error:
Too few arguments to function Tapp\Airtable\AirtableManager::table(), 0 passed

i even tried to put the data in the airtable.php directly.. doesnt help

i tried to do it in a new project, not working either

my steps

  1. laravel new [NAME]
  2. composer require tapp/laravel-airtable
  3. php artisan vendor:publish --provider="Tapp\Airtable\AirtableServiceProvider"
  4. Updated .env
    AIRTABLE_KEY=hidden AIRTABLE_BASE=hidden AIRTABLE_TABLE=Gesamtportfolio
  5. Updated web.php
    Route::get('/', function () { Airtable::table()->get(); });

Error
Too few arguments to function Tapp\Airtable\AirtableManager::table(), 0 passed

this worked for me, return array("name"=>$name);
this should be commented. //return $this->app['config']["airtable.tables.default.{$name}"];
File: AirtableManager.php

I think i know what the problem was.

It probably looks in the standard view, which is the "Grid View", but on my table there wasn't a view called "Grid view" because we deleted it.

So probably you could a something like a filter so you can pass in your view you want to search in.

https://i.imgur.com/Fddd0Vv.png

I'm getting the same problem: It doesn't seem to be picking up the name of the default table. dump(env('AIRTABLE_TABLE')) gives Event, which is the right default table name for me, but when I try something simple like:

    $r = Airtable::where('metric', 'thing1')->get();

I get:

Too few arguments to function Tapp\Airtable\AirtableManager::table(), 0 passed in /Users/marcus/project/vendor/tapp/laravel-airtable/src/AirtableManager.php on line 147 and exactly 1 expected

I think the problem is that while it's clear that you have to set the default table, it's not clear that you also need to create an entry in the name of the table that is the default, that is, I can't just say:

'tables' => [
    'default'         => [
        'name' => 'Event',
    ],

I have to say:

'tables' => [
    'default'         => [
        'name' => 'Event',
    ],
    'Event' => [
        'name' => 'Event',
    ],

This seems a bit unnecessary - why do table names have to be declared beforehand like this, when you can simply name one in a call to table()?