2017 © Pedro Peláez
 

library laravel-extra-features

This package provides useful features to give extra functionality to your Laravel project

image

edujugon/laravel-extra-features

This package provides useful features to give extra functionality to your Laravel project

  • Tuesday, February 14, 2017
  • by edujugon
  • Repository
  • 1 Watchers
  • 3 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Laravel Extra Features

This package provides useful features to give extra functionality to your Laravel project., (*1)

Installation

type in console:, (*2)

composer require edujugon/laravel-extra-features

Laravel 5.*

Register the package service by adding it to the providers array., (*3)

IMPORTANT! Ensure you put that line at the end of the providers list., (*4)

'providers' => array(
    ...
    Edujugon\LaravelExtraFeatures\Providers\LaravelExtraFeaturesServiceProvider::class
)

Publish the package's configuration file to the application's own config directory, (*5)

php artisan vendor:publish  --tag=ExtraFeaturesConfig

The above line will create a file called extrafeatures.php under config folder., (*6)

Feature List

Functionality, (*7)

Traits, (*8)

Services, (*9)

  • [QueryCreator](https://github.com/edujugon/LaravelExtraFeatures#querycreator

Redirect No Page Found

When user tries to load an unknown url, it's redirected to a specific known url., (*10)

!IMPORTANT, This feature won't work for local environment. That's an intended behaviour no to hide any redirect/request error., (*11)

  • Go to config/extrafeatures.php file and update the value for the key REDIRECT_NO_PAGE_FOUND.

Carbon Locale

Carbon language is set based on the laravel's app locale. By default it is enabled. You may disable changing CARBON_LOCALE value to falsein config/extrafeatures.php file., (*12)

DateScopesTrait

Provide extra features on year, month and day to retrieve data for Laravel Eloquent., (*13)

Adding $dateColumn as model class's property you don't need to pass the $dateColumn parameter to the methods., (*14)

    /**
     * Get items of passed year
     * If no year, returns Items of current year
     *
     * @param $query
     * @param $column
     * @param null $year
     * @return mixed
     */
    public function scopeYear($query,$dateColumn = null,$year = null)
    /**
     * Get items of passed month
     * If no month, take current month
     * If no year, take current year
     *
     * @param $query
     * @param $column
     * @param null $month
     * @param null $year
     * @return mixed
     */
    public function scopeMonth($query,$dateColumn = null,$month = null,$year = null)
    /**
     * Get items of passed day.
     * If no day, take current day
     * If no month, take current month
     * If no year, take current year
     *
     * @param $query
     * @param $column
     * @param null $day
     * @param null $month
     * @param null $year
     * @return mixed
     */
    public function scopeDay($query,$dateColumn = null,$day = null, $month = null, $year = null)

QueryCreator

Create DB query dynamically, (*15)

    /**
         * Create a query dynamically with passed parameters.
         *
         * Params:
         *  tableName is the table name.
         *  array is a list of data to be converted to query.
         * 
         * @param $tableName
         * @param array $array
         * @return mixed
         */
        static public function dynamic($tableName, array $array)

API list

Table

table method sets the table name for the Query., (*16)

Syntax, (*17)

object table($tableName)
Build

build method builds the query based on passed array., (*18)

Syntax, (*19)

object build(arrray $data)

Use Cases

$array = [
            '<'=>['pvr'=>'pvl'],
            'like'=>['id_imagen'=>'"%5047%"'],
            'null'=>['margen_1']
        ];
 QueryCreator::dynamic('products',$array)->select('id','id_imagen')->first());

The Versions

14/02 2017

dev-master

9999999-dev

This package provides useful features to give extra functionality to your Laravel project

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel core features extra features extra functionality

26/10 2016

v1.0.2

1.0.2.0

This package provides useful features to give extra functionality to your Laravel project

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel core features extra features extra functionality

24/10 2016

v1.0.1

1.0.1.0

This package provides useful features to give extra functionality to your Laravel project

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel core features extra features extra functionality

21/10 2016

v1.0.0

1.0.0.0

This package provides useful features to give extra functionality to your Laravel project

  Sources   Download

MIT

The Requires

 

by Eduardo Marcos

laravel core features extra features extra functionality