I am trying to replicates a record in my database here is my controller
private Receiver $receiver;
public function __construct()
{
$this->receiver = new Receiver();
...
}
$this->receiver = $receiverData;
if ($reversed) {
$receiver = Receiver::find($receiverData['id']);
$new_receiver = $receiver->replicate();
$this->receiver = $new_receiver;
} else {
$this->receiver->user_id = $receiverData->user_id = auth()->id();
}
$this->receiver->save();
dd($this->receiver);
Now the debug shows correct results
#attributes: array:11 [▶
"user_id" => 1
"city_id" => 2
"name" => "Mohamed"
"address" => "Al noor st. 15 city"
"phone" => "054545488877"
"email" => "[email protected]"
"latitude" => null
"longitude" => null
"updated_at" => "2023-11-26 18:09:38"
"created_at" => "2023-11-26 18:09:38"
"id" => 148
]
But it dose not insert any records to my database any idea what could be the issue here.