public function File()
{
return $this->hasOne(File::class, 'image_id','id');
}
public function User()
{
return $this->hasMany(User::class);
}
public function index(Request $request)
{
$data = User::orderBy('id','DESC')->paginate(5);
$image = File:: //здесь нужен where()?
return view('admin.users.index',compact('data'))
->with('i', ($request->input('page', 1) - 1) * 5);
}
@foreach ($data as $user)
<tr>
<td>{{ ++$i }}</td>
<td>{{ $user->name }}</td>
<td>{{ $user->image }}</td>
</tr>
@endforeach
$image = $request->file('image');
$filename = time().'.'.$image->getClientOriginalExtension();
$location = public_path('files/images/blog/' . $filename);
mkdir($location, 0755);
chmod($location, 0755);
Image::make($image)->save($location);
{!! Form::file('image', null, ['class' => 'form-control', 'enctype' => 'multipart/form-data']) !!}
$image_file = $request->file('image');
if ($request->hasFile('image'))
{
$image_file->move('/testupload');
}