Merge pull request #38 from jbrooksuk/subscribers-migration
Added subscribers migration with accompanying model
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSubscribersTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('subscribers', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('email')->nullable(false);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('subscribers');
|
||||
}
|
||||
|
||||
}
|
||||
15
app/models/Subscriber.php
Normal file
15
app/models/Subscriber.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingTrait;
|
||||
|
||||
class Subscriber extends Eloquent {
|
||||
use ValidatingTrait;
|
||||
use SoftDeletingTrait;
|
||||
|
||||
protected $rules = [
|
||||
'email' => 'required|email'
|
||||
];
|
||||
|
||||
protected $fillable = ['email'];
|
||||
}
|
||||
Reference in New Issue
Block a user