PHP code example of padosoft / laravel-validable
1. Go to this page and download the library: Download padosoft/laravel-validable 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/ */
padosoft / laravel-validable example snippets
namespace App;
use Padosoft\Laravel\Validable\Validable;
use Illuminate\Database\Eloquent\Model;
class YourEloquentModel extends Model
{
use Validable;
protected static $rules = [
'name'=>'
class YourEloquentModel extends Model
{
use Validable;
protected static $rules = [
'name'=>' 'name'=>'equired'=>'obbligatorio'
];
}
$model = new YourEloquentModel;
$model->name='test';
if (!$model->save()){
$erros=$model->getErrors();
}
$rules=YourEloquentModel::getRules();