i'm using Laravel 7 to make a automation system. i have a letter, i can send it to one or many recievers. after that i have to be able to send reply to that letter, it's a loop and can be reply several times. This is my letter table structure : Letter Table Structure
as you can see i have a replyto field
i don't know how can i make this controllers or also table fields
here is Store function for Letter :
public function store(Request $request)
{
$recieve_ids = $request->recieve_id;
foreach ($recieve_ids as $recieve_id) {
Letter::create([
'indicator_id' => $request['indicator_id'],
'sender_id' => auth()->user()->id,
'recieve_id' => $recieve_id,
'title' => $request['title'],
'image' => 'default.png',
'description' => $request['description'],
'date' => $request['date'],
'text' => $request['text'],
'number' => '100',
'refrence_text' => ' ',
'replyto' => 0,
]);
}
return redirect(route('Letter.index'));
}
and this is my reply_letter function for show reply page, but i don't know how can i insert new data (new reply) to letter :
public function reply_letter($id)
{
$v = new Verta();
$date = $v->format('%d %B %Y');
$letter = Letter::find($id);
return view('Letter.reply', compact('date', 'letter'));
}
reply can be done by sender or reciever letter.
Thank you for your help <3
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire