24 lines
655 B
PHP
24 lines
655 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
use Illuminate\Routing\Controller as BaseController;
|
|
|
|
class Controller extends BaseController
|
|
{
|
|
use AuthorizesRequests, ValidatesRequests;
|
|
function validate_11_or_12_digits($string) {
|
|
// Check if the string contains only digits
|
|
if (ctype_digit($string)) {
|
|
// Check if the length is 11 or 12
|
|
$length = strlen($string);
|
|
if ($length === 11 || $length === 12) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|