Laravel Overflow is a package by Logan H. Craft that allows adding an overflow column to a form request. An overflow column contains request values in a JSON or TEXT column in the database.
Defining an overflow column involves using a form request with the package’s Overflowable
trait:
1use Illuminate\Foundation\Http\FormRequest; 2use CraftLogan\LaravelOverflow\Overflowable; 3 4class OverflowFormRequest extends FormRequest 5{ 6 use Overflowable; 7 public $table = 'test_models'; 8 public $overflow_column = 'properties'; 9 10 // ...11}
The trait provides some methods for separating table columns from database table columns:
1// Get JSON-encoded overflow data2$model->properties = $request->overflow();3 4// Get table columns and overflow in one array5$request->allWithOverflow();6 7// Get database columns that intersect with $request->all() keys8$request->getColumns();
You can learn more about this package, get full installation instructions, and view the source code on GitHub at CraftLogan/Laravel-Overflow.
0 comments:
Post a Comment
Thanks