普通にHTMLで書いた場合
<form action="/uploadfile" method="post" enctype="multipart/form-data"> @csrf <div class="form-group"> <input type="file" class="form-control-file" name="fileToUpload" id="exampleInputFile"> </div> <button type="submit" class="btn btn-primary">Submit</button> </form>
collectiveのForm::openのthird parameterに’files’=>trueを追加する
Form:file(‘file’)とする
{!! Form::open(['method'=>'POST', 'action'=>'PostsController@store', 'files'=>true]) !!}
		{{ csrf_field()}}
		<div class="form-group">
			{!! Form::file('file', ['class'=>'form-controll']) !!}
		</div>
		<div class="form-group">
			{!! Form::label('title', 'Title') !!}
			{!! Form::text('title', null, ['class'=>'form-controll']) !!}
		</div>
		<div class="form-group">
			{!! Form::submit('Create Post', ['class'=>'btn btn-primary']) !!}
		</div>
	{!! Form::close() !!}
controller
public function store(CreatePostRequest $request)
    {
        return $request->file('file');
    }
オリジナル名、ファイルサイズ
public function store(CreatePostRequest $request)
    {
        $file = $request->file('file');
        
        echo "<br>";
        echo $file->getClientOriginalName();
        echo "<br>";
        echo $file->getClientSize();
    }
$ php artisan make:migration add_path_column_to_posts –table=posts
migration file
public function up()
    {
        Schema::table('posts', function (Blueprint $table) {
            //
            $table->string('path');
        });
    }
public function down()
    {
        Schema::table('posts', function (Blueprint $table) {
            //
            $talbe->dropColumn('path');
        });
    }
$ php artisan migrate
Post.php
protected $fillable = [ 'user_id', 'title', 'content', 'path' ];
PostsController.php
public function store(CreatePostRequest $request)
    {
        $input = $request->all();
        if($file = $request->file('file')){
            $name = $file->getClientOriginalName();
            $file->move('./images', $name);
            $input['path'] = $name;
        }
        Post::create($input);
    }
view
<ul>
		@foreach($posts as $post)
		<div class-"image-container">
			<img height="100" src="images/{{$post->path}}">
		</div>
		<li><a href="{{ route('posts.show', $post->id) }}">{{$post->title}}</a></li>
		
		@endforeach
	</ul>
images/{{$post->path}} は、accessorsでimages/を省略する
Model:Post.php
public $directory = "/images/";
public function getPathAttribute($value){
		return $this->directory . $value;
	}
View: index.php
<div class-"image-container">
			<img height="100" src="{{$post->path}}">
		</div>
今回はシンプルな書き方で、ファイルに対する拡張子やファイルサイズのバリデーションをつけていませんが、コントローラーもしくはrequestsでバリデーションを付ければ良いでしょう。
ファイルの格納場所はサーバー内ですが、これをS3にする場合はmove()の箇所を変える必要があります。
 
					 
