PHP code example of 3neti / laravel-model-input

1. Go to this page and download the library: Download 3neti/laravel-model-input 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/ */

    

3neti / laravel-model-input example snippets


loadMigrationsFrom()

use LBHurtado\ModelInput\Traits\HasInputs;

class User extends Model
{
    use HasInputs;
}

$user->setInput('mobile', '09171234567');

use LBHurtado\ModelInput\Enums\InputType;

$user->setInput(InputType::MOBILE, '09171234567');

$user->forceSetInput('mobile', '09171234567');

$user->mobile;
$user->signature;

$user->isValidInput('email', '[email protected]');

User::findByMobile('09171234567');
User::findByInput('mobile', '09171234567');

$user->input('mobile');

InputType::MOBILE
InputType::EMAIL
InputType::SIGNATURE
InputType::OTP
...

model-input.rules.mobile
bash
php artisan vendor:publish --tag=config
bash
php artisan migrate