I'm using foreignId in my migration and it is converting to string, but primary key is working fine.
By the way I'm using Laravel 8, PHP 8
this is my migration
Schema::create('tokens', function (Blueprint $table) {
$table->id();
$table->foreignId('shop_id');
$table->timestamps();
});
then if I want to convert this model to json
$token = Token::find(1);
return response()->json($token, 200);
I will receive this
{
id: 1,
shop_id: "12",
created_at: "2021-06-08T12:41:07.000000Z"
updated_at: "2021-06-08T12:41:07.000000Z"
}