DONE: layout letter with letterhead and footer, notification for newly...
This commit is contained in:
@@ -20,7 +20,7 @@ trait HasDocuments
|
||||
*/
|
||||
public function documentsOfType($type)
|
||||
{
|
||||
return $this->documents()->where('document_type', $type);
|
||||
return $this->documents()->where('type', $type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,15 +33,15 @@ trait HasDocuments
|
||||
|
||||
// Store file in a folder named after the model
|
||||
$folderName = strtolower(class_basename($this));
|
||||
$filePath = $file->storeAs("documents/{$folderName}", $fileName);
|
||||
$filePath = $file->storeAs("documents/{$folderName}", $fileName, Document::STORAGE_DISK);
|
||||
|
||||
// Create document record
|
||||
return $this->documents()->create([
|
||||
'document_name' => $file->getClientOriginalName(),
|
||||
'document_path' => $filePath,
|
||||
'name' => $file->getClientOriginalName(),
|
||||
'path' => $filePath,
|
||||
'file_size' => $file->getSize(),
|
||||
'mime_type' => $file->getClientMimeType(),
|
||||
'document_type' => $documentType,
|
||||
'type' => $documentType,
|
||||
'description' => $description,
|
||||
'uploaded_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user