How to add the name of the uploaded file in the controller ?
In the migration, I created a field with the name of the document, in the model I also registered it in the filled fields. How can I enter my names for them in the form when uploading files?
Controller @ store
if ($request->hasFile('passport'))
{
foreach($request->file('passport') as $passport){
$str_passport = $passport->store('passport', 'public');
$homes->passportDocuments()->create(['document' => $str_passport]);
}
}
Model Passport
protected $fillable = [
'document',
'document_name',
];
public function house()
{
return $this->belongsTo(Houses::class);
}