i cant store the number generated from str_random() function. database stores all other inputs but not this, its always empty. it doesnt even show an error. it just stores it as empty text. i even checked with dd() function the $token variable contains a random string even after storing it to the database. its strange, i need help!!
public function store(Request $request)
{
$token="";
$chatToken1 = str_random(16);
$chatToken2 = str_random(16);
$token = $chatToken1.$chatToken2;
ChatMessage::create([
'to_user_id' => $request->get('to_user_id'),
'from_user_id' => auth()->user()->id,
'message' => $request->get('chat_message'),
'chat_key' => $token,
'status' => '1'
]);
Aucun commentaire:
Enregistrer un commentaire