Support the ongoing development of Laravel.io →
Input Database Forms

Hi, i have a table like this:

Schema::create('partners', function (Blueprint $table) {
  $table->increments('id');
  $table->binary('image');
  $table->string('name');
  $table->string('link');
  $table->timestamps();
});

Then, after validation, i need to add data from forms, defined as this: {{Form::file('image')}} I tried this way:

public function newPartner(Request $request) {
        
  $validator = Validator::make($request->all(), [
    'name' => 'required',
    'link' => 'required'
  ]);
  if ($validator->fails()) {
     return redirect('partners/create')->withErrors($validator);
  }
  Partner::create($request->all());

  return redirect('/');
}

But it doesn't fill the binary field with the uploaded image.

How can I achieve this? Thank you

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

luca89pe luca89pe Joined 3 Apr 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.