-
Notifications
You must be signed in to change notification settings - Fork 4
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
207e575
commit 265c8b7
Showing
10 changed files
with
354 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Touhidurabir\ModelSanitize\Tests\App; | ||
|
||
use Touhidurabir\ModelSanitize\Sanitizable; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
|
||
class Address extends Model { | ||
|
||
use SoftDeletes; | ||
|
||
use Sanitizable; | ||
|
||
/** | ||
* The model associated table | ||
* | ||
* @var string | ||
*/ | ||
protected $table = 'addresses'; | ||
|
||
|
||
/** | ||
* The attributes that are not mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $guarded = [ | ||
'extras', | ||
]; | ||
|
||
} |
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,33 @@ | ||
<?php | ||
|
||
namespace Touhidurabir\ModelSanitize\Tests\App; | ||
|
||
use Touhidurabir\ModelSanitize\Sanitizable; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
|
||
class Nation extends Model { | ||
|
||
use SoftDeletes; | ||
|
||
use Sanitizable; | ||
|
||
/** | ||
* The model associated table | ||
* | ||
* @var string | ||
*/ | ||
protected $table = 'nations'; | ||
|
||
|
||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'name', | ||
'code', | ||
]; | ||
|
||
} |
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,43 @@ | ||
<?php | ||
|
||
namespace Touhidurabir\ModelSanitize\Tests\App; | ||
|
||
use Touhidurabir\ModelSanitize\Sanitizable; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
|
||
class State extends Model { | ||
|
||
use SoftDeletes; | ||
|
||
use Sanitizable; | ||
|
||
/** | ||
* The model associated table | ||
* | ||
* @var string | ||
*/ | ||
protected $table = 'states'; | ||
|
||
|
||
/** | ||
* The attributes that are not mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $guarded = [ | ||
'city_counts', | ||
]; | ||
|
||
|
||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'name', | ||
'code', | ||
]; | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
tests/App/database/migrations/2014_10_12_000002_create_addresses_table.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,39 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
class CreateAddressesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
DB::connection()->getSchemaBuilder()->create('addresses', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->string('address_line_1'); | ||
$table->string('address_line_2')->nullable(); | ||
$table->string('nation')->nullable(); | ||
$table->string('state')->nullable(); | ||
$table->string('city')->nullable(); | ||
$table->string('zip')->nullable(); | ||
$table->text('extras')->nullable(); | ||
$table->boolean('status')->default(true); | ||
$table->timestamps(); | ||
$table->softDeletes(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
DB::connection()->getSchemaBuilder()->dropIfExists('addresses'); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
tests/App/database/migrations/2014_10_12_000003_create_nations_table.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,35 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
class CreateNationsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
DB::connection()->getSchemaBuilder()->create('nations', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->string('name'); | ||
$table->string('code'); | ||
$table->string('description')->nullable(); | ||
$table->boolean('status')->default(true); | ||
$table->timestamps(); | ||
$table->softDeletes(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
DB::connection()->getSchemaBuilder()->dropIfExists('nations'); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/App/database/migrations/2014_10_12_000004_create_states_table.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,36 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
class CreateStatesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
DB::connection()->getSchemaBuilder()->create('states', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->string('name'); | ||
$table->string('code'); | ||
$table->string('description')->nullable(); | ||
$table->integer('city_counts')->nullable(); | ||
$table->boolean('status')->default(true); | ||
$table->timestamps(); | ||
$table->softDeletes(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
DB::connection()->getSchemaBuilder()->dropIfExists('states'); | ||
} | ||
} |
Oops, something went wrong.