Skip to content

Commit 1418a51

Browse files
committed
Initial commit
0 parents  commit 1418a51

11 files changed

+6071
-0
lines changed

.gitattributes

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.github export-ignore
6+
/tests export-ignore
7+
/.gitattributes export-ignore
8+
/.gitignore export-ignore
9+
/phpunit.xml export-ignore
10+
/.editorconfig export-ignore

.github/workflows/ci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
tests:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Install dependencies
12+
run: composer install
13+
- name: Start Redis
14+
uses: supercharge/[email protected]
15+
- name: Run tests
16+
run: phpunit

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Samuel Štancl
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Eloquent Virtual Column
2+
3+
## Installation
4+
5+
Supports Laravel 6 and 7.
6+
7+
```
8+
composer require stancl/virtual-column
9+
```
10+
11+
## Usage
12+
13+
Use the `VirtualColumn` model on your model:
14+
```php
15+
use Illuminate\Database\Eloquent\Model;
16+
use Stancl\VirtualColumn\VirtualColumn;
17+
18+
class MyModel extends Model
19+
{
20+
use VirtualColumn;
21+
22+
public $guarded = [];
23+
}
24+
```
25+
26+
Create a migration:
27+
```php
28+
public function up()
29+
{
30+
Schema::create('my_models', function (Blueprint $table) {
31+
$table->increments('id');
32+
33+
$table->string('custom1')->nullable();
34+
$table->string('custom2')->nullable();
35+
36+
$table->json('data');
37+
});
38+
}
39+
```
40+
41+
And store any data on your model:
42+
43+
```php
44+
$myModel = MyModel::create(['foo' => 'bar']);
45+
$myModel->update(['foo' => 'baz']);
46+
```

composer.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "stancl/virtualcolumn",
3+
"description": "Eloquent virtual column.",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Samuel Štancl",
8+
"email": "[email protected]"
9+
}
10+
],
11+
"autoload": {
12+
"psr-4": {
13+
"Stancl\\VirtualColumn\\": "src/"
14+
}
15+
},
16+
"autoload-dev": {
17+
"psr-4": {
18+
"Stancl\\VirtualColumn\\Tests\\": "tests/"
19+
}
20+
},
21+
"require": {
22+
"illuminate/support": "^6.0|^7.11",
23+
"illuminate/database": "^6.0|^7.11"
24+
},
25+
"require-dev": {
26+
"orchestra/testbench": "^4.0|^5.2"
27+
}
28+
}

0 commit comments

Comments
 (0)