I created an image uploading method in my parent class. now I want to pass an input image file to that method from my child class. I am getting an error when I pass the file.
Parent class,
class BaseController extends Controller{
public function upload($file,$fname,$a,$b,$c){
$file = $request->file('featured');
if ($file->isValid()) {
.....
}else {
.....
}
}
}
Child class,
class PageController extends BaseController{
public function store(Request $request)
{
BaseController::upload($file,'pages',$request->banner_alt,
$request->banner_caption,$request->banner_description);
}
}
And I get an error: Call to a member function isValid() on null. Could anybody here help me, please? Thanks in Advance :)