-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from RonasIT/165-implement-insert-method
#165: Implement insert method
- Loading branch information
Showing
7 changed files
with
212 additions
and
2 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
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
31 changes: 31 additions & 0 deletions
31
tests/support/Mock/TestModelWithDifferentTimestampNames.php
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace RonasIT\Support\Tests\Support\Mock; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
use RonasIT\Support\Traits\ModelTrait; | ||
|
||
class TestModelWithDifferentTimestampNames extends Model | ||
{ | ||
use ModelTrait; | ||
use SoftDeletes; | ||
|
||
public const string CREATED_AT = 'creation_date'; | ||
public const string UPDATED_AT = 'updated_date'; | ||
|
||
public $timestamps = true; | ||
|
||
protected $table = 'test_models'; | ||
|
||
protected $fillable = [ | ||
'name', | ||
'json_field', | ||
'castable_field', | ||
]; | ||
|
||
protected $casts = [ | ||
'json_field' => 'array', | ||
'castable_field' => JSONCustomCast::class, | ||
]; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace RonasIT\Support\Tests\Support\Mock; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
use RonasIT\Support\Traits\ModelTrait; | ||
|
||
class TestModelWithoutTimestamps extends Model | ||
{ | ||
use ModelTrait; | ||
use SoftDeletes; | ||
|
||
public $timestamps = false; | ||
|
||
protected $table = 'test_models'; | ||
|
||
protected $fillable = [ | ||
'name', | ||
'json_field', | ||
'castable_field', | ||
]; | ||
|
||
protected $casts = [ | ||
'json_field' => 'array', | ||
'castable_field' => JSONCustomCast::class, | ||
]; | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/support/Mock/TestRepositoryWithDifferentTimestampNames.php
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace RonasIT\Support\Tests\Support\Mock; | ||
|
||
use RonasIT\Support\Repositories\BaseRepository; | ||
|
||
class TestRepositoryWithDifferentTimestampNames extends BaseRepository | ||
{ | ||
public function __construct() | ||
{ | ||
$this->setModel(TestModelWithDifferentTimestampNames::class); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace RonasIT\Support\Tests\Support\Mock; | ||
|
||
use RonasIT\Support\Repositories\BaseRepository; | ||
|
||
class TestRepositoryWithoutTimestamps extends BaseRepository | ||
{ | ||
public function __construct() | ||
{ | ||
$this->setModel(TestModelWithoutTimestamps::class); | ||
} | ||
} |
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