Драйвер [] не поддерживается. — Laravel 5.3

я использую backpackforlaravel настроить внутреннюю область моего сайта. Я добавил поле изображения в свой ProjectCrudController:

$this->crud->addField([
'label' => "Project Image",
'name' => "image",
'type' => 'image',
'upload' => true,
], 'both');

В моей модели проект у меня есть мутатор как это:

public function setImageAttribute($value)
{
$attribute_name = "image";
$disk = "public_folder";
$destination_path = "uploads/images";

// if the image was erased
if ($value==null) {
// delete the image from disk
\Storage::disk($disk)->delete($this->image);

// set null in the database column
$this->attributes[$attribute_name] = null;
}

// if a base64 was sent, store it in the db
if (starts_with($value, 'data:image'))
{
// 0. Make the image
$image = \Image::make($value);
// 1. Generate a filename.
$filename = md5($value.time()).'.jpg';

// 2. Store the image on disk.
\Storage::disk($disk)->put($destination_path.'/'.$filename, $image->stream());
// 3. Save the path to the database
$this->attributes[$attribute_name] = $destination_path.'/'.$filename;
}
}

В моем общественности папка у меня есть / загрузки / изображения / папка.

Но когда я хочу сохранить проект, я получаю следующую ошибку:

InvalidArgumentException в строке FilesystemManager.php 121:

Драйвер [] не поддерживается.

введите описание изображения здесь

мой файл filesystems.php в моем конфиг папка выглядит так:

<?php

return [

'default' => 'local',

'cloud' => 's3',

'disks' => [

'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],

'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'visibility' => 'public',
],

's3' => [
'driver' => 's3',
'key' => 'your-key',
'secret' => 'your-secret',
'region' => 'your-region',
'bucket' => 'your-bucket',
],
'uploads' => [
'driver' => 'local',
'root' => public_path('uploads'),
],

],

'storage' => [
'driver' => 'local',
'root'   => storage_path(),
],

];

В чем может быть проблема здесь? я использую Laravel Homestead версия 2.2.2.

6

Решение

Здесь вы определили $disk как public_folder:

public function setImageAttribute($value)
{
$attribute_name = "image";
$disk = "public_folder";
$destination_path = "uploads/images";

Но в вашем filesystem.php у вас нет диска public_folder

Вам нужно создать новый диск «public_folder»

'disks' => [

'public_folder' => [
'driver' => 'local',
'root' => public_path('uploads'),
],

или переименуйте свой $disk переменная на другой диск:

public function setImageAttribute($value)
{
$attribute_name = "image";
//Uploads disk for example
$disk = "uploads";
14

Другие решения

Других решений пока нет …