Ответы пользователя по тегу Laravel
  • Laravel excel, как сохранить файл в проект?

    @random362
    Вроде бы в доке есть ответы на все вопросы
    1. Storing Files
    use Illuminate\Support\Facades\Storage;
     
    Storage::put('file.jpg', $contents);
    Storage::put('file.jpg', $resource);

    2. Mail#attachments
    /**
     * Get the attachments for the message.
     *
     * @return array<int, \Illuminate\Mail\Mailables\Attachment>
     */
    public function attachments(): array
    {
        return [
            Attachment::fromStorage('/path/to/file'),
        ];
    }


    такой код, он сразу отправляет файл на загрузку

    Не на загрузку, а на скачивание.
    Ответ написан
    Комментировать