I have a table in my MySql database with reports that contains images for each report. Currently i am setting my image names like this when saving them and sending their path to the database:
file_put_contents('/uploads/image-'. $request->input('user_id') .'.png', $data);
$report->image_1 = '/uploads/image1-'. $request>input('user_id') .'.png';
The problem with this is that the users with be able to make multiple reports so that wont work in the long run because it will override after each new report by the users. So i have to instead of setting the user_id somehow set the autoincremented value at the end of each image. Is this possible to do? The primary key with autincremented value is called " report_id".
My wanted result would be something like this:
file_put_contents('/uploads/image-'. $request->input('report_id') .'.png', $data);
$report->image_1 = '/uploads/image1-'. $request>input('report_id') .'.png';