2017-02-26 37 views
2

私はbackpackforlaravelを使って私のウェブサイトのバックエンド領域を設定しています。私が持っている私のパブリックフォルダにドライバ[]はサポートされていません。 - Laravel 5.3

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; 
    } 
} 

:私はこのようなミューテータを持って私のモデルプロジェクト

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

:私は私のProjectCrudControllerに画像フィールドを追加しました/uploads/images/フォルダー

しかし、私は、私は次のエラーを取得していますプロジェクトを保存したい:

InvalidArgumentException in FilesystemManager.php line 121:

Driver [] is not supported.

enter image description here

設定フォルダ内のマイ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を使用しています。

答えて

9

ここでは、public_folderとして$disk定義:

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"; 
関連する問題