Laravel4 Model primary key value is lost after insert
问题 <?php // Model class ProfileDelivery extends \Eloquent { protected $table = 'profile_delivery'; protected $guarded = array(); public $timestamps = FALSE; } // Somewhere $deliveryGuy->id = 1; print $deliveryGuy->id; // Prints 1 if (!$deliveryGuy->save()) { throw new \Exception('Cant save .'); } print $deliveryGuy->id; // Prints 0 Can anyone explain me why the ID value is lost? 回答1: Not sure if you solved this for your situation but in Laravel 5.1 this just happened to me - the primary key of