When using laravel-stapler get an "FileNotFoundException" error on store methods.
This is not an error of laravel-stapler, because problem happens AFTER model is saved.
Problem is this:
/vendor/adminarchitect/core/src/Controllers/AdminController.php @ redirectTo
creates a second instance of the request, that validates the file, but the file doesn't exist, laravel-stapler alredy moved it
This is the error:
FileNotFoundException
The file "C:\wamp\tmp\php9259.tmp" does not exist
--
in File.php (line 37)
at File->__construct('C:\\wamp\\tmp\\php9259.tmp', true)in UploadedFile.php (line 96)
at UploadedFile->__construct('C:\\wamp\\tmp\\php9259.tmp', 'agent-02.jpg', 'image/jpeg', 78436, 0, false)in UploadedFile.php (line 105)
at UploadedFile::createFromBase(object(UploadedFile))in InteractsWithInput.php (line 251)
at Request->Illuminate\Http\Concerns\{closure}(object(UploadedFile))
at array_map(object(Closure), array('avatar' => object(UploadedFile)))in InteractsWithInput.php (line 252)
at Request->convertUploadedFiles(array('avatar' => object(UploadedFile)))in InteractsWithInput.php (line 233)
at Request->allFiles()in InteractsWithInput.php (line 121)
at Request->all()in InteractsWithInput.php (line 71)
at Request->exists('save')in Facade.php (line 221)
at Facade::__callStatic('exists', array('save'))in AdminController.php (line 66)
at Request::exists('save')in AdminController.php (line 66)
at AdminController->redirectTo('test', 19)in ScaffoldController.php (line 126)
at ScaffoldController->store('test', object(UpdateRequest))
this happens:
ScaffoldController @ store
instantiates UpdateRequest $request and laravel-stapler moves the file in line 120
then calls
AdminController @ redirectTo
where it instantiantes another request in
Request::exists('save');
Laravel executes this method, failing:
Request->convertUploadedFiles
This solved it in my machine:
ScaffoldController @ store
When using laravel-stapler get an "FileNotFoundException" error on store methods.
This is not an error of laravel-stapler, because problem happens AFTER model is saved.
Problem is this: /vendor/adminarchitect/core/src/Controllers/AdminController.php @ redirectTo creates a second instance of the request, that validates the file, but the file doesn't exist, laravel-stapler alredy moved it
This is the error:
this happens:
ScaffoldController @ store instantiates UpdateRequest $request and laravel-stapler moves the file in line 120
then calls AdminController @ redirectTo where it instantiantes another request in Request::exists('save');
Laravel executes this method, failing: Request->convertUploadedFiles
This solved it in my machine: ScaffoldController @ store
passing the request as variable
then using the same request object in AdminController@redirectTo
I don't know if this is the best approach, didn't make any more tests.
reproduce the error with this simple test: https://bitbucket.org/eduardoarandah/admin-architect-test