This repository has been archived by the owner on Jan 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e69531
commit 64489bd
Showing
2 changed files
with
33 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":1172:{a:2:{s:7:"defects";a:3:{s:92:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_extra_properties_with_create_method";i:4;s:96:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_extra_properties_using_model_attributes";i:4;s:70:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_get_table_columns";i:5;}s:5:"times";a:8:{s:92:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_extra_properties_with_create_method";d:0.01;s:96:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_extra_properties_using_model_attributes";d:0.003;s:94:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_multiple_extra_properties_to_overflow";d:0.086;s:70:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_get_table_columns";d:0.003;s:95:"CraftLogan\LaravelOverflow\Tests\OverflowTest::it_can_add_multiple_extra_properties_to_overflow";d:0.084;s:93:"CraftLogan\LaravelOverflow\Tests\OverflowTest::it_can_add_extra_properties_with_create_method";d:0.01;s:71:"CraftLogan\LaravelOverflow\Tests\OverflowTest::it_can_get_table_columns";d:0.003;s:97:"CraftLogan\LaravelOverflow\Tests\OverflowTest::it_can_add_extra_properties_using_model_attributes";d:0.003;}}} | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":1173:{a:2:{s:7:"defects";a:3:{s:92:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_extra_properties_with_create_method";i:4;s:96:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_extra_properties_using_model_attributes";i:4;s:70:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_get_table_columns";i:5;}s:5:"times";a:8:{s:92:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_extra_properties_with_create_method";d:0.01;s:96:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_extra_properties_using_model_attributes";d:0.003;s:94:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_add_multiple_extra_properties_to_overflow";d:0.086;s:70:"CraftLogan\LaravelOverflow\Tests\ExampleTest::it_can_get_table_columns";d:0.003;s:95:"CraftLogan\LaravelOverflow\Tests\OverflowTest::it_can_add_multiple_extra_properties_to_overflow";d:0.106;s:93:"CraftLogan\LaravelOverflow\Tests\OverflowTest::it_can_add_extra_properties_with_create_method";d:0.012;s:71:"CraftLogan\LaravelOverflow\Tests\OverflowTest::it_can_get_table_columns";d:0.003;s:97:"CraftLogan\LaravelOverflow\Tests\OverflowTest::it_can_add_extra_properties_using_model_attributes";d:0.003;}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
![Laravel Overflow Logo](https://raw.githubusercontent.com/CraftLogan/Laravel-Overflow/master/Laravel%20Overflow.png) | ||
![Laravel Overflow Logo](https://raw.githubusercontent.com/CraftLogan/Laravel-Overflow/master/Laravel%20Overflow.png#logo) | ||
|
||
|
||
# Laravel Overflow | ||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/craftlogan/laravel-overflow.svg?style=flat-square)](https://packagist.org/packages/craftlogan/laravel-overflow) | ||
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/spatie/laravel-responsecache/run-tests?label=tests) | ||
[![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) | ||
[![Quality Score](https://img.shields.io/scrutinizer/g/craftlogan/laravel-overflow.svg?style=flat-square)](https://scrutinizer-ci.com/g/craftlogan/laravel-overflow) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/craftlogan/laravel-overflow.svg?style=flat-square)](https://packagist.org/packages/craftlogan/laravel-overflow) | ||
|
||
The Laravel Overflow package will allow to easily add an overflow column to a form request. Use this package to make it easy to store overflow request values in a json column on database table:) | ||
# 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: | ||
|
@@ -23,17 +25,18 @@ Defining the overflow column and table using a custom form request: | |
``` php | ||
<?php | ||
|
||
namespace App\Http\Requests; | ||
namespace CraftLogan\LaravelOverflow\Requests; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
use CraftLogan\LaravelOverflow\Overflowable; | ||
|
||
class CustomFormRequest extends FormRequest | ||
class OverflowFormRequest extends FormRequest | ||
{ | ||
use Overflowable; | ||
public $table = 'programs'; | ||
public $table = 'test_models'; | ||
public $overflow_column = 'properties'; | ||
|
||
|
||
/** | ||
* Determine if the user is authorized to make this request. | ||
* | ||
|
@@ -61,16 +64,36 @@ Using with the CREATE Method: | |
``` php | ||
public function store(CustomFormRequest $request) | ||
{ | ||
$mymodel = MyModel::create($request->allWithOverflow()); | ||
$testmodel = TestModel::create($request->allWithOverflow()); | ||
} | ||
``` | ||
|
||
Using with the object Attributes: | ||
|
||
``` php | ||
// Usage description here | ||
$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: | ||
|
||
``` php | ||
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 | ||
|
||
``` bash | ||
|
@@ -85,9 +108,6 @@ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recen | |
|
||
Please see [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
|
||
### Security | ||
|
||
If you discover any security related issues, please email [email protected] instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
|
@@ -98,6 +118,5 @@ If you discover any security related issues, please email [email protected] i | |
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. | ||
|
||
## Laravel Package Boilerplate | ||
|
||
This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com). | ||
This package used scafolding from the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com) built by [Marcel Pociot](https://twitter.com/marcelpociot) |