lumen

Laravel Model Factory without connection to database

感情迁移 提交于 2021-02-18 10:12:23
问题 I would like to use Laravel's Model Factory in some PHPUnit tests. The only thing I want to do is make a Model instance without saving it to database. Why the Model Factory needs connection to database? These tests must pass on CI environment without configured database. When I create Model manually by new App\Model($dataArray) , tests pass and the connection is not needed. I am using Model Factory in other places, so I would like to reuse it in that tests, to avoid code duplication. I am

Laravel Model Factory without connection to database

為{幸葍}努か 提交于 2021-02-18 10:10:34
问题 I would like to use Laravel's Model Factory in some PHPUnit tests. The only thing I want to do is make a Model instance without saving it to database. Why the Model Factory needs connection to database? These tests must pass on CI environment without configured database. When I create Model manually by new App\Model($dataArray) , tests pass and the connection is not needed. I am using Model Factory in other places, so I would like to reuse it in that tests, to avoid code duplication. I am

PHP web application performance measurement tool

三世轮回 提交于 2021-02-17 06:37:06
问题 Need some web application performance measurement tool.. Can you guys suggest me some better ones.. Purpose: First, app is built on Lumen and Dashboard is built upon Laravel. So why I want something is to measure all requests performance to app and then I can to note down results of each and every requests' time consumption, based on that app can be optimized in better way I did some google found JMeter is most of the people's choice, as its from apache and does the job but it looks lil

Upload image to external webservice/API using Lumen/Laravel and Guzzle 6

狂风中的少年 提交于 2021-02-11 16:35:55
问题 I want to upload an image to a webservice using Lumen + Guzzle 6. The external web service does not accept "base64-encoding" the image to be sent. Only the image file is accepted as such. But I still get an error message from the external webservice/API that the image could not be found or it rather seems to be that Guzzle sent the request without the image. The check with file_exists($filename_with_path) responded successfully, therefore access to the file is generally possible. If I work

Upload image to external webservice/API using Lumen/Laravel and Guzzle 6

萝らか妹 提交于 2021-02-11 16:35:00
问题 I want to upload an image to a webservice using Lumen + Guzzle 6. The external web service does not accept "base64-encoding" the image to be sent. Only the image file is accepted as such. But I still get an error message from the external webservice/API that the image could not be found or it rather seems to be that Guzzle sent the request without the image. The check with file_exists($filename_with_path) responded successfully, therefore access to the file is generally possible. If I work

PHP exception not being caught, laravel, lumen

荒凉一梦 提交于 2021-02-08 07:59:58
问题 When attempting to catch/handle an exception thrown from PDFParser, I cannot catch it. I use a simple try catch statement, outlined below. try{ $pdf = $parser->parseFile($filepath); $text = $pdf->getText(); } catch( \Exception $e){ $text = $paper->abstract; } The exception is thrown as follows. if (empty($data)) { throw new \Exception('Object list not found. Possible secured file.'); } The output is here. lumen.ERROR: Exception: Object list not found. Possible secured file. in /Users

PHP exception not being caught, laravel, lumen

我们两清 提交于 2021-02-08 07:58:52
问题 When attempting to catch/handle an exception thrown from PDFParser, I cannot catch it. I use a simple try catch statement, outlined below. try{ $pdf = $parser->parseFile($filepath); $text = $pdf->getText(); } catch( \Exception $e){ $text = $paper->abstract; } The exception is thrown as follows. if (empty($data)) { throw new \Exception('Object list not found. Possible secured file.'); } The output is here. lumen.ERROR: Exception: Object list not found. Possible secured file. in /Users

PHP exception not being caught, laravel, lumen

限于喜欢 提交于 2021-02-08 07:58:41
问题 When attempting to catch/handle an exception thrown from PDFParser, I cannot catch it. I use a simple try catch statement, outlined below. try{ $pdf = $parser->parseFile($filepath); $text = $pdf->getText(); } catch( \Exception $e){ $text = $paper->abstract; } The exception is thrown as follows. if (empty($data)) { throw new \Exception('Object list not found. Possible secured file.'); } The output is here. lumen.ERROR: Exception: Object list not found. Possible secured file. in /Users

How to customize JSON format of error in validation in Lumen(Laravel)

二次信任 提交于 2021-02-08 06:54:19
问题 I am sending error messages like this in case of errors in getting data from DB or any other issue: return response()->json(['status' => 'Failed' ,'state'=>'100' , 'message'=>'You have not registered yet.' ], 401); This gives me a JSON which has everything defined so I easily show the message whatever the problem is. But in case of error in case of validation, I don't seem to have the power to change the format of the error response JSON. $this->validate($request, [ 'email' => 'required',

MethodNotAllowedHttpException (lumen) while making request with axios

房东的猫 提交于 2021-02-07 10:54:37
问题 Created a route for inserting todo in lumen , its working perfectly using postman but in my react application request sending with axios , it getting error this.apiUrl = 'http://lumenback.dev/createTodo'; axios.post(this.apiUrl, { todo: this.state.todo, todo_date: this.props.curDate }) .then(function (response) { console.log(response); }).catch(function (error) { console.log(error); }); thanks in advance... 回答1: Your application is not accepting the Cross domain requests I guess. Here is an