这是我的控制器
$directory = config('app.filesDestinationPath').'/'.'a'.'/'.'b'.'/'.'c'.'/';
它也不能正常工作。 我认为它不需要$project>划分和用户并创建在。
$project = Project::find($project->id);
$diviz = Project::find($project->division);
$user = Project::find($project->user);
$create = Project::find($project->created_at);
$comments = $project->comments;
$directory = config('app.filesDestinationPath').'/'.$diviz.'/'.$user.'/'.$create.'/';
$files = Storage::files($directory);
return view('projects.show', ['project'=>$project, 'comments'=> $comments ])->with(array('files' => $files));
这是我的模型
protected $fillable = [
'description',
'division',
'who',
'whom',
'content',
'user',
'filename'
];
这是我的迁移
Schema::create('projects', function (Blueprint $table) {
$table->increments('id');
$table->string('description')->nullable();
$table->string('division')->nullable();
$table->string('who')->nullable();
$table->string('whom')->nullable();
$table->string('content')->nullable();
$table->text('user');
$table->text('filename');
$table->timestamps();
});
如果你的问题与这行代码有关
$directory = config('app.filesDestinationPath').'/'.$diviz.'/'.$user.'/'.$create.'/';
那么你用错了。 $diviz、$user$create是模型类,您尝试将这些类与字符串连接起来,这将导致不同的输出。