framework
framework copied to clipboard
[Request] Eloquent shouldn't override timestamps if they have been sent.
Eloquent shouldn't override timestamps if they have been sent. An example of the same is below:
//Model Code
<?php
class User extends Eloquent
{
public $timestamps = true;
public $tables = 'users';
public $connection = 'new_db';
protected $guarded=array();
}
//Controller Code
class UserController extends BaseController
{
public function migrateUsers(){
$users = DB:connection('old_db')->table('users')->get();
foreach($users as $user){
User::create(array('username'=>$user->username,
'password'=>$user->password,
'role' => $user->role,
'created_at'=>$user->created_at
));
}
}
}
+1
+1 for data recovery, import & more
Should be easy with the recently added array_add helper (which was added for about the same purpose)
+1