fk/laravel-references

There is no license information available for the latest version (v2.0.10) of this package.

Just docs and auto-completion for Laravel development

v2.0.10 2020-02-27 15:23 UTC

This package is not auto-updated.

Last update: 2024-11-04 21:51:09 UTC


README

Class references for the Laravel default facades and methods that invoke __call of a class

This is convenient for IDE code completion Inspired by barryvdh

Directory

  • config
    • framework.php

      Contains all caller => callee classes

    • framework.__call.php

      Contains all refers in __call, this will be called recursively

Register

<?php

namespace App\Providers;

use fk\reference\IdeReferenceServiceProvider;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->register(IdeReferenceServiceProvider::class);
    }
}

Publish

artisan vendor:publish

Usage

Generate a eloquent model with properties with database constrains (as rules).

artisan reference:model table_name

Event: Eloquent saving

Register event-listener in your event provider, and then every saving will validate the rules in Eloquent first.

How

Update \App\Providers\EventServiceProvider set $listen

protected $listen = [
    \App\Events\ModelSaving::class => [
        \App\Listeners\CheckRules::class,
    ],
];