Skip to content

Commit be31461

Browse files
author
Toby Allen
committed
add NoModel
1 parent 1cec7c6 commit be31461

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/Concerns/HasNoTable.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Tobya\Anymodel\Concerns;
4+
5+
trait HasNoTable
6+
{
7+
/**
8+
*
9+
* @param $options
10+
* @return bool
11+
* @throws \Exception
12+
*/
13+
public function Save($options = []){
14+
throw new \Exception('Save() method Not implemented on this model as it is not connected to a table. ');
15+
}
16+
}

src/NoModel.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Tobya\Anymodel;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
use Tobya\Anymodel\Concerns\HasNoTable;
7+
8+
9+
class NoModel extends Model
10+
{
11+
use HasNoTable;
12+
public $timestamps = false;
13+
protected $guarded = [];
14+
15+
16+
}

0 commit comments

Comments
 (0)