PHP code example of edujugon / laravel-extra-features

1. Go to this page and download the library: Download edujugon/laravel-extra-features 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/ */

    

edujugon / laravel-extra-features example snippets


    /**
     * 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)

    /**
         * 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)

object table($tableName)

object build(arrray $data)

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


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

php artisan vendor:publish  --tag=ExtraFeaturesConfig