Browse Source

install eloquentfilter

moell 1 year ago
parent
commit
3057d92ee9

+ 2 - 1
composer.json

@@ -9,7 +9,8 @@
         "guzzlehttp/guzzle": "^7.2",
         "laravel/framework": "^10.10",
         "laravel/sanctum": "^3.3",
-        "laravel/tinker": "^2.8"
+        "laravel/tinker": "^2.8",
+        "tucker-eric/eloquentfilter": "^3.2"
     },
     "require-dev": {
         "fakerphp/faker": "^1.9.1",

+ 56 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "a81180ddf661b3bdca1e389601b002f7",
+    "content-hash": "71b37f0b21fd331d85701a14def36ca9",
     "packages": [
         {
             "name": "brick/math",
@@ -4155,6 +4155,61 @@
             "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
             "time": "2023-12-08T13:03:43+00:00"
         },
+        {
+            "name": "tucker-eric/eloquentfilter",
+            "version": "3.2.0",
+            "dist": {
+                "type": "zip",
+                "url": "https://mirrors.cloud.tencent.com/repository/composer/tucker-eric/eloquentfilter/3.2.0/tucker-eric-eloquentfilter-3.2.0.zip",
+                "reference": "faaad783b7f23af7ba7e23baaa56d71af51504a9",
+                "shasum": ""
+            },
+            "require": {
+                "illuminate/config": "~6.0|~7.0|~8.0|~9.0|~10.0",
+                "illuminate/console": "~6.0|~7.0|~8.0|~9.0|~10.0",
+                "illuminate/database": "~6.0|~7.0|~8.0|~9.0|~10.0",
+                "illuminate/filesystem": "~6.0|~7.0|~8.0|~9.0|~10.0",
+                "illuminate/pagination": "~6.0|~7.0|~8.0|~9.0|~10.0",
+                "illuminate/support": "~6.0|~7.0|~8.0|~9.0|~10.0",
+                "php": ">=7.2"
+            },
+            "require-dev": {
+                "mockery/mockery": "^1.3",
+                "phpunit/phpunit": "^8"
+            },
+            "type": "library",
+            "extra": {
+                "laravel": {
+                    "providers": [
+                        "EloquentFilter\\ServiceProvider"
+                    ]
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "EloquentFilter\\": "src/"
+                }
+            },
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Eric Tucker",
+                    "email": "tucker.ericm@gmail.com"
+                }
+            ],
+            "description": "An Eloquent way to filter Eloquent Models",
+            "keywords": [
+                "eloquent",
+                "filter",
+                "laravel",
+                "model",
+                "query",
+                "search"
+            ],
+            "time": "2023-02-07T18:34:53+00:00"
+        },
         {
             "name": "vlucas/phpdotenv",
             "version": "v5.6.0",

+ 39 - 0
config/eloquentfilter.php

@@ -0,0 +1,39 @@
+<?php
+
+return [
+
+    /*
+     |--------------------------------------------------------------------------
+     | Eloquent Filter Settings
+     |--------------------------------------------------------------------------
+     |
+     | This is the namespace all you Eloquent Model Filters will reside
+     |
+     */
+
+    'namespace' => 'App\\ModelFilters\\',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Custom generator stub
+    |--------------------------------------------------------------------------
+    |
+    | If you want to override the default stub this package provides
+    | you can enter the path to your own at this point
+    |
+    */
+//    'generator' => [
+//        'stub' => app_path('stubs/modelfilter.stub')
+//    ]
+
+    /*
+    |--------------------------------------------------------------------------
+    | Default Paginator Limit For `paginateFilter` and `simplePaginateFilter`
+    |--------------------------------------------------------------------------
+    |
+    | Set paginate limit
+    |
+    */
+    'paginate_limit' => env('PAGINATION_LIMIT_DEFAULT',15)
+
+];

+ 28 - 0
database/migrations/2024_01_16_134404_add_company_id_to_user_table.php

@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::table('users', function (Blueprint $table) {
+            $table->integer('company_id')->nullable()->comment();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('users', function (Blueprint $table) {
+            $table->dropColumn('company_id');
+        });
+    }
+};