trinityrank/test-package

Test paket

This package's canonical repository appears to be gone and the package has been frozen as a result.

v1.5 2022-05-11 12:32 UTC

This package is auto-updated.

Last update: 2022-12-11 13:42:25 UTC


README

Latest Version on Packagist Total Downloads

Choose to show or hide Operaters by choosing the countries from list.

Installation

Step 1: Install package

To get started with Laravel Geo Location, use Composer command to add the package to your composer.json project's dependencies:

    composer require search

Step 2: Publishing

  • You need to publish files from package (config an js)
    php artisan vendor:publish --provider="Trinityrank\Search\SearchServiceProvider"

Step 3: JS

  • Include JS file in your js mix
    ...
    .js('resources/js/search.js', 'public/js')
    ...
  • And then compile JS in console:
    npm run dev
  • Or only for one speciffic tenant
    php artisan tenant:artisan "migrate" --tenant=[--TENANT-ID--]

Step 3: Operaters Model database

Add this fields to '$fillable' inside Operaters model

    public $fillable = [
        ...
        'geolocation_option',
        'geolocation_countries',
    ];

Step 4: Add field

  • Add field to your (Operater) resource into "fields" method
    use Trinityrank\GeoLocation\GeoLocationPanel;
    
    ...
    
    GeoLocationPanel::make()
  • Or if you use conditional fields than just add this into "fields" method
      $this->getGeoLocationPanel('GeoLocation Page Settings', 'geolocation')
    

Step 5: If you are using conditional fields

Add this in tenant config

    'conditional_fields' => [
        ...

        'operater' => [
            'geolocation' => [
                'visible' => true
            ]
        ]

        ...
    ]

Step 6: Frontend part

  • Without token
    use Trinityrank\GeoLocation\GeoLocationOperater;

    ...

    $operaters = GeoLocationOperater::list($operaters_array);
  • With token

Add new variable in .ENV file

    GEOLOCATION_API_TOKEN=[--Replace-this-with-website-token--]

You can connect with 'config/main.php' file

    'geolocation_api_token' => env('GEOLOCATION_API_TOKEN', null),

Then we can use our Geo Location

    use Trinityrank\GeoLocation\GeoLocationOperater;

    ...

    $operaters = GeoLocationOperater::list($operaters_array, $api_token = [optional]);