PHP code example of spoorsny / laravel-model-validating-observer

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

    

spoorsny / laravel-model-validating-observer example snippets


use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Model;

use Spoorsny\Laravel\Contracts\SelfValidatingModel;
use Spoorsny\Laravel\Observers\ValidateModel;

#[ObservedBy(ValidateModel::class)]
class Car extends Model implements SelfValidatingModel
{
    public static function validationRules(): array
    {
        return [
            'rules' => [
                'make' => '