2017 © Pedro Peláez
 

library laravel-helpers

Helpers for laravel framework

image

thunder-birds-studio/laravel-helpers

Helpers for laravel framework

  • Wednesday, July 4, 2018
  • by ThunderBirdsX3
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

laravel-helpers

Helpers for laravel framework., (*1)

1. Helper fof(Class::class, $class_or_id) use for auto find the model using id or Model.

It may helper some reason. When use design pattern and you don't need it make a query every times when you pass data to your Services or Repositories. Or when you not sure you should pass Model or only id to other class., (*2)

class FooController
{
    /**
     * @var FooService
     */
    protected $foo_service;

    /**
     * @param FooService $foo_service
     */
    public function __construct(FooService $foo_service)
    {
        $this->foo_service = $foo_service;
    }

    /**
     * @param int $foo_id
     */
    public function bar($foo_id)
    {
        $this->foo_service->bar($foo_id);
    }

    /**
     * @param FooModel $foo
     */
    public function barz(FooModel $foo)
    {
        $this->foo_service->bar($foo);
    }
}
class FooService
{
    /**
     * @param FooModel|int $foo
     */
    public function bar($foo)
    {
        $foo = fof(FooModel::class, $foo);

        // Do somethings.
    }
}

The Versions

04/07 2018

v1.1.0

1.1.0.0

Helpers for laravel framework

  Sources   Download

MIT

The Requires

 

by Supasin Dum-umpai

laravel framework helpers