-
-
Save thangngoc89/b98d29fc79927d954827 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Test Model | |
<?php | |
use Illuminate\Database\Eloquent\Model as Eloquent; | |
class Test extends Eloquent { | |
protected $table = 'test'; | |
protected $hidden = array(); | |
protected $fillable = array('id', 'title'); | |
protected $nullable = []; | |
public $timestamps = false; | |
public static function boot() { | |
parent::boot(); | |
parent::setEventDispatcher(new Dispatcher()); | |
static::creating(function($test){ | |
write_log('model event creating', 'model_event'); | |
}); | |
} | |
} | |
// Test Controller | |
//$test = Test::create(['title' => 'test']); | |
//$test = Test::insert(['title' => 'test']); | |
$test = new Test; | |
$test->title = 'test'; | |
$test->save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment