Skip to content
The Laravel Overflow package will allow adding an overflow column to a form request easily. Use this package to make it easy to store overflow request values in a JSON or Text column on a database table:)
PHP
Branch: master
Clone or download
Latest commit feab268 Jan 16, 2020

README.md

Laravel Overflow Logo

All Contributors

Latest Version on Packagist GitHub Workflow Status MIT Licensed Quality Score Total Downloads

Laravel Overflow

The Laravel Overflow package will allow adding an overflow column to a form request easily. Use this package to make it easy to store overflow request values in a JSON or Text column on a database table:)

Installation

You can install the package via composer:

composer require craftlogan/laravel-overflow

Usage

Extend a form request using the OverflowFromRequest and specify the model to catch overflow.

<?php
namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use CraftLogan\LaravelOverflow\Requests\OverflowFormRequest

class CustomFormRequest extends OverflowFormRequest
{
    public function __construct()
    {
        parent::__construct(new TestModel);  // Your Eloquent Model
    }
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [];
    }
}

Using with the CREATE Method:

public function store(CustomFormRequest $request)
{
    $testmodel = TestModel::create($request->allWithOverflow());
}

Using with the object Attributes:

        $testmodel = new TestModel();
        $testmodel->name = $request->name;
        $testmodel->properties = $request->overflow();
        $testmodel->save();

When setting up a migration you can use a json column or a text column:

    public function up()
    {
        Schema::create('test_models', function (Blueprint $table){
            $table->increments('id');
            //$table->text('properties');  // Use this column type if you are using sqlite or a mysql version less than 5.7
            //$table->json('properties');  // If your database supports json then I would recommend using the json column
            $table->timestamps();
        });
    }

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributors

Thanks goes to these wonderful people (emoji key):


Daniel

💻

Logan H. Craft

💻

Laravel News

📝

Paul Redmond

📝

Contributing

Please see CONTRIBUTING for details.

This project follows the all-contributors specification. Contributions of any kind welcome!

License

The MIT License (MIT). Please see License File for more information.

This package used scafolding from the Laravel Package Boilerplate built by Marcel Pociot

You can’t perform that action at this time.