Answer the question
In order to leave comments, you need to log in
How does Request work in Laravel?
I'm trying to upload an image to the server. Controller:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Models\MainScreenModel;
public function adminStore(Request $request) {
// Main Screen //
$main_screen = MainScreenModel::find(1);
$main_screen->main_title = $request->main_title;
$main_screen->main_subtitle = $request->main_subtitle;
$main_screen->save();
if (Request::hasFile('main_image')) {
dd('Has File!!');
};
}
Non-static method Illuminate\Http\Request::hasFile() should not be called statically, assuming $this from incompatible context
Undefined property: Illuminate\Support\Facades\Request::$main_title
Answer the question
In order to leave comments, you need to log in
should not be called statically - doesn't that mean anything to you?
https://laravel.com/docs/master/requests#files - what about documentation?
Why are you using a facade if you have already passed the request object to the controller with a line
Try$request->hasFile()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question