Yelfive / laravel-references by yelfive

Just docs and auto-completion for Laravel development
114
1
2
Package Data
Maintainer Username: yelfive
Package Create Date: 2017-04-19
Package Last Update: 2020-03-16
Language: PHP
License: Unknown
Last Refreshed: 2025-02-06 15:05:45
Package Statistics
Total Downloads: 114
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

laravel-references

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,
    ],
];