PHP code example of pardalsalcap / linter-locations

1. Go to this page and download the library: Download pardalsalcap/linter-locations 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/ */

    

pardalsalcap / linter-locations example snippets


return [
    'available_locales' => [
        'ca' => 'Català',
        'es' => 'Castellano',
        'en' => 'English',
    ],
    'use_scoped_search' => true,
];

// Example of associating a user with an address
$user = User::find(1);
$address = Address::find(1);

$user->addresses()->attach($address->id, ['address_type' => 'home']);

use Illuminate\Database\Eloquent\Model;
use Pardalsalcap\LinterLocations\Traits\HasAddresses;

class User extends Model
{
    use HasAddresses;

    // User model methods and properties
}

$user = User::find(1);
$address = Address::find(1);

// Attach an address to the user
$user->attachAddress($address);

// Detach an address from the user
$user->detachAddress($address);

// Sync addresses (attach new ones and detach others)
$addresses = Address::whereIn('id', [1, 2, 3])->get();
$user->syncAddresses($addresses);


namespace App\Filament\Resources;

class ContinentResource extends \Pardalsalcap\LinterLocations\Resources\ContinentResource
{
    // Customizations (if any) go here
}

namespace App\Filament\Resources;

use App\Models\YourModel;
use Pardalsalcap\LinterLocations\Resources\AddressResource\RelationManagers\AddressableRelationManager;

class YourModelResource extends \Filament\Resources\Resource
{
    public static function getRelations(): array
    {
        return [
            AddressableRelationManager::class,
        ];
    }

    // Other resource configurations...
}
bash
php artisan vendor:publish --tag="linter-locations-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="linter-locations-config"