PHP code example of lee-to / laravel-airtable

1. Go to this page and download the library: Download lee-to/laravel-airtable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lee-to / laravel-airtable example snippets


use Airtable;
sh
php artisan vendor:publish --provider="AirTableLaravel\Providers\AirTableServiceProvider"
 php
Airtable::get();
 php
Airtable::all();
 php
Airtable::find('ID');
 php
Airtable::all(["Column1", "Column2"]);
 php
Airtable::table('table_name')->update('ID', ["Column1" => "Value"]);
 php
foreach(Airtable::get() as $record) {
    $record->update(["Column1" => "Value"]);
}
 php
Airtable::table('table_name')->updateOrCreate('ID', ["Column1" => "Value"]);
 php
Airtable::table('table_name')->create(["Column1" => "Value"]);
 php
Airtable::table('table_name')->firstOrCreate(["Column1" => "Value"]);
 php
foreach(Airtable::table('table_name')->get() as $record) {
    $deleted = $record->delete();
    
    $deleted->isDeleted(); // Check is deleted or not
}
 php
foreach(Airtable::table('table_name')->get() as $record) {
    $record->getId(); // ID 
    
    $record->COLUMN1; // Any fields in table 
}