How can I get the entity ID after saving it? I am saving an entity and I would want to get its ID.
$CustomerEntity = CustomerEntity::create([
  'customer_id' =&gt; $customer['id'],
  'customer_name' =&gt; $customer['name'],
  'address' =&gt; $customer['address'],
]);

$CustomerEntity-&gt;save();

How do I get the entity ID with that code?
Use $CustomerEntity-&gt;id(); after saving your entity.
$CustomerEntity = CustomerEntity::create([
  'customer_id' =&gt; $customer['id'],
  'customer_name' =&gt; $customer['name'],
  'address' =&gt; $customer['address'],
]);

$CustomerEntity-&gt;save();
$id = $CustomerEntity-&gt;id();