create populate on laravel code example
Example 1: insert rows in migrations laravel
public function up()
{
Schema::create('users', function($table){
$table->increments('id');
$table->string('email', 255);
$table->string('password', 64);
$table->boolean('verified');
$table->string('token', 255);
$table->timestamps();
});
DB::table('users')->insert(
array(
'email' => '[email protected]',
'verified' => true
)
);
}
Example 2: fresh laravel
$flight = Flight::where('number', 'FR 900')->first();
$flight->number = 'FR 456';
$flight->refresh();
$flight->number;