I have a problem in storing an image and multiple input
this is my image code
                $ngo = new User;           
 $user_certificate = Request::file('user_certificate');
            $destination_path = 'Certificate/';
            $filename = str_random(6).'_'.$user_certificate->getClientOriginalName();
            $user_certificate->move($destination_path, $filename);
            $ngo->user_certificate = $destination_path . $filename;
$ngo->save();
my multiple input
$bank = $request->bank_name;
                foreach ($bank as $asd) {
                    $banks = new BankAccount;
                    $banks->user_id = $user->id; 
                    $banks->bank_name = $asd;
                    $banks->account_name = $request['account_name'];
                    $banks->account_number = $request['account_number'];
                    $banks->save();
            }         
When i use use Illuminate\Http\Request; the image upload will error and this is the error.
Non-static method Illuminate\Http\Request::file() should not be called statically, assuming $this from incompatible context
and the multiple input are ok then when i change the use Illuminate\Http\Request; to use Request; it will error.
Undefined property: Illuminate\Support\Facades\Request::$bank_name
Anyone can help me to solve this problem?
via Chebli Mohamed
 
Aucun commentaire:
Enregistrer un commentaire