lumen-5.4

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

MethodNotAllowedHttpException (lumen) while making request with axios

ぃ、小莉子 提交于 2021-02-07 10:53:54
问题 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

Lumen 5.6.4 get post route throwing MethodNotAllowedHttpException

99封情书 提交于 2020-01-06 05:30:30
问题 whenever i try to access my url for a post in Lumen through the browser or postman i get the below error Whoops, looks like something went wrong. MethodNotAllowedHttpException in RoutesRequests.php at Application->handleDispatcherResponse(array(2, array('POST'))) in RoutesRequests.php see route code from web.php below $router->post('gen','VoucherController@generateVoucherCode'); see code from generateVoucherCode class VoucherController extends Controller { public function generateVoucherCode

Route with dot (IP address) not found, returns 404

删除回忆录丶 提交于 2019-12-24 11:56:01
问题 I use Lumen 5.4 . This is how my route is setup: $app->get('/ip/{ip}', GeoIpController::class . '@show'); The {ip} route parameter should be an IP address, with dots in it. However, it seems there is a problem when a route has dots in it. It returns a 404 not found error. I am aware I could pass the IP address in as a simple GET request parameter, but want the IP to be part of the URL and to be handled like a route parameter. For testing purposes, I use php -S localhost:8080 -t public to

“Invalid_grant” response when use Twinfield Openid Oauth connect

笑着哭i 提交于 2019-12-24 02:47:30
问题 This is the library which I used https://github.com/php-twinfield/ It's an issue when I call the Oauth login. I have completed almost APIs with username and password but client wants it with Oauth. I think there is a problem in redirectUri. When I called Oauth it always show: { "success": false, "error": "invalid_grant" } This is my credential. Clientid and clientsecret is obtained from mail and the redirect uri set from Openid Twinfield link. Please correct me if there is anything wrong in

Laravel - Collection with relations take a lot of time

╄→尐↘猪︶ㄣ 提交于 2019-12-12 09:27:08
问题 We are developing an API with LUMEN. Today we had a confused problem with getting the collection of our "TimeLog"-model. We just wanted to get all time logs with additional informationen from the board model and task model. In one row of time log we had a board_id and a task_id. It is a 1:1 relation on both. This was our first code for getting the whole data. This took a lot of time and sometimes we got a timeout: BillingController.php public function byYear() { $timeLog = TimeLog::get();

$ Composer can't find mongodb extension, required Mongodb extension

不问归期 提交于 2019-12-10 17:47:58
问题 I'm using with latest php version 7.2 on macOS Mojave and receiving error like $composer require mongodb/mongodb Using version ^1.4 for mongodb/mongodb ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) For more information about question : see the screenshoot Your requirements could not be resolved to an installable set of packages. Problem 1 - mongodb/mongodb v1.4.x-dev requires ext-mongodb ^1.5.0 -> the

Laravel - Collection with relations take a lot of time

半世苍凉 提交于 2019-12-04 20:58:41
We are developing an API with LUMEN. Today we had a confused problem with getting the collection of our "TimeLog"-model. We just wanted to get all time logs with additional informationen from the board model and task model. In one row of time log we had a board_id and a task_id. It is a 1:1 relation on both. This was our first code for getting the whole data. This took a lot of time and sometimes we got a timeout: BillingController.php public function byYear() { $timeLog = TimeLog::get(); $resp = array(); foreach($timeLog->toArray() as $key => $value) { if(($timeLog[$key]->board_id && $timeLog