TappNetwork/laravel-airtable

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

karneaud opened this issue · 2 comments

In running the code Airtable::find($record_id) I get the output error

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

at /var/www/vendor/tapp/laravel-airtable/src/AirtableManager.php:42
at Tapp\Airtable\AirtableManager->table()
(/var/www/vendor/tapp/laravel-airtable/src/AirtableManager.php:149)
at Tapp\Airtable\AirtableManager->__call('find', array('reclPuLCImaRag12o'))
(/var/www/vendor/illuminate/support/Facades/Facade.php:261)
at Illuminate\Support\Facades\Facade::__callStatic('find', array('reclPuLCImaRag12o'))

Do I need to pass in the table name? As I can confirm that env('AIRTABLE_TABLE') has been defined

Can you confirm that you have the following values set:

AIRTABLE_KEY=
AIRTABLE_BASE=
AIRTABLE_TABLE=

Can you also confirm that your configuration isn't cached? I usually do this with tinker:

Psy Shell v0.10.6 (PHP 7.4.13 — cli) by Justin Hileman
>>> config('airtable.default');
=> "default"
>>> config('airtable.tables.default');
=> [
     "name" => "Contact",
   ]
>>>

Does this work when you manually specify the table in the query?

Airtable::table('contacts')->find($record_id)

Here is an example of how I have the different tables configured:


Psy Shell v0.10.6 (PHP 7.4.13 — cli) by Justin Hileman
>>> config('airtable.tables');
=> [
     "default" => [
       "name" => "Contact",
     ],
     "contacts" => [
       "name" => "Contact",
     ],
     "companies" => [
       "name" => "Company Name",
     ],
     "offices" => [
       "name" => "Offices",
     ],
     "lockers" => [
       "name" => "Lockers",
     ],
     "parking-passes" => [
       "name" => "Parking Passes",
     ],
     "office-types" => [
       "name" => "Office Types",
     ],
     "swipe-badges" => [
       "name" => "Swipe Badges",
     ],
   ]

@swilla

I can confirm that the .env is set. I am using Lumen. But I did not try it with explicitly setting the table....did not think I needed to.