lumen

Lumen shared controller

我是研究僧i 提交于 2020-01-15 06:51:30
问题 I wrote a "Helper" controller that I want to use in other controllers, but I am doing something wrong. Is Lumen Service what i need? Then I just don't get how to set it up. My main class: namespace App\Http\Controllers; use App\Http\Controllers\HelperController as Helper; class InitController extends Controller { public function work($hash, $type) { return response()->json([ 'answer' => Helper::makeCodeUrl() ]); } } Helper controller: namespace App\Http\Controllers; class HelperController

Connecting Heroku Lumen App to Amazon RDS MySQL 5.7.19

倾然丶 夕夏残阳落幕 提交于 2020-01-14 06:35:32
问题 I have granted access for the Amazon RDS MySQL instance (5.7.19) for 0.0.0.0/0 as suggested by Heroku. This makes the connection work successfully. When I force SSL for the mysql-user (ALTER USER 'user'@'%' REQUIRE SSL;) the connection breaks. I have followed these instructions from Heroku. My Heroku DATABASE_URL config variable: mysql://username:password@AMAZONRDSMYSQLURL/DATABASE?sslca=config/amazon-rds-ca-cert.pem The certificate is stored under /config/amazon-rds-ca-cert.pem From my

Lumen installation error

人盡茶涼 提交于 2020-01-13 19:46:11
问题 I am trying to install lumen with composer so I used the command below composer create-project --prefer-dist laravel/lumen api But, for some reason I am getting this error before even doing anything, just visiting the public folder. Sorry, the page you are looking for could not be found. 1/1 NotFoundHttpException in RoutesRequests.php line 442: in RoutesRequests.php line 442 at Application->handleDispatcherResponse(array('0')) in RoutesRequests.php line 381 at Application->Laravel\Lumen

Converting a laravel application to lumen

耗尽温柔 提交于 2020-01-12 07:17:15
问题 So, I have been building a laravel 5.1 API and after months of work on it it dawned on me that I should have been using Lumen all along. Is there a way to convert a laravel app to a lumen app? 回答1: Lumen is essentially a stripped down version of Laravel. The application structure is the same, so as far as that goes it should be safe to create a new Lumen app and copy the app directory from your Laravel app. However, for performance reasons, Lumen does not have all the Laravel goodies working

Laravel Lumen Queue Failure with queue:work but not queue:listen

别来无恙 提交于 2020-01-06 07:13:43
问题 I have an issue where I have a command that inserts jobs into a DB queue. I have a service "supervisor" basically running artisan queue:work continuesily (I should also mention I have a once per min cron job running artisan schedule:run). If I just run this command and let the supervisor pick up when the queued job should run I get this exception: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method App\Services\MiddlewareApi::get_lowest_active_customer_number_by

Laravel Lumen Queue Failure with queue:work but not queue:listen

六月ゝ 毕业季﹏ 提交于 2020-01-06 07:13:10
问题 I have an issue where I have a command that inserts jobs into a DB queue. I have a service "supervisor" basically running artisan queue:work continuesily (I should also mention I have a once per min cron job running artisan schedule:run). If I just run this command and let the supervisor pick up when the queued job should run I get this exception: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method App\Services\MiddlewareApi::get_lowest_active_customer_number_by

Lumen - Missing commands

安稳与你 提交于 2020-01-05 17:00:50
问题 I have a problem with running Lumen's Artisan. There are most of the commands missing. For an example if I write php artisan routes , I get following error: Command "routes" is not defined. Below is an example of output that I get by typing php artisan. Laravel Framework version Lumen (5.2.5) (Laravel Components 5.2.*) Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi

Lumen Class Route Not found

扶醉桌前 提交于 2020-01-05 06:27:52
问题 I am trying to implement the code stated in Laracast. $proxy = Request::create( '/oauth/token', 'POST' ); return Route::dispatch($proxy); This gives me error Class Route Not found .My question is how can we use Route:dispatch() in lumen ? Thanks 回答1: Lumen 5.4 global $app; $proxy = Request::create( '/oauth/token', 'post', [ 'grant_type'=>$grant_type, 'client_id'=>$client_id, 'client_secret'=>$client_secret, 'username'=>$username, 'password'=>$password ] ); return $app->dispatch($proxy); 回答2:

Laravel 5.5 Custom Soft Deletes on Model

筅森魡賤 提交于 2020-01-04 03:51:32
问题 My posts are defined as soft deleted or not via the value in the status column, where: 0 = unavailable, 1 = available, and 77 = soft deleted. Currently, I add a global scope in the model to make sure I don't return soft-deleted posts: protected static function boot() { parent::boot(); static::addGlobalScope('status', function (Builder $builder) { $builder->where('status', '!=', '77'); }); } How would I modify softDelete (laravels built-in functionality) of a model from its default of

Redis Queue Failed Job is being logged to MySQL

点点圈 提交于 2020-01-03 19:16:32
问题 Queue driver is set to use Redis QUEUE_DRIVER=redis With php /opt/artisan queue:work --tries=1 --queue="data-ingestion-default" --daemon The error, we receive is [2016-09-14 08:32:40] lumen.ERROR: InvalidArgumentException: Database [mysql] not configured. in /opt/vendor/illuminate/database/DatabaseManager.php:239 Stack trace: #0 /opt/vendor/illuminate/database/DatabaseManager.php(158): Illuminate\Database\DatabaseManager->getConfig('mysql') #1 /opt/vendor/illuminate/database/DatabaseManager