1. Go to this page and download the library: Download gordonsarah/tz-phone 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/ */
use GordonSarah\TzPhone\Laravel\Models\TzPhoneOperator;
use GordonSarah\TzPhone\Laravel\Models\TzPhonePrefix;
$yas = TzPhoneOperator::where('slug', 'yas')->first();
TzPhonePrefix::create([
'operator_id' => $yas->id,
'prefix' => '070',
'status' => 'operational',
'notes' => 'Added after TCRA gazette',
]);
use GordonSarah\TzPhone\OperatorRegistry;
use GordonSarah\TzPhone\Stores\DatabaseOperatorStore;
$store = DatabaseOperatorStore::sqlite(__DIR__.'/tz-phone.sqlite');
$store->seedFromConfig(OperatorRegistry::defaultConfig());
$registry = OperatorRegistry::instance()->useStore($store);
$registry->addPrefix('vodacom', '070'); // written to SQLite
use GordonSarah\TzPhone\Laravel\Rules\TzPhoneRule;
$request->validate([
'phone' => ['le::make('vodacom', 'airtel')],
]);