lumen

Lumen php artisan config:cache not found

非 Y 不嫁゛ 提交于 2019-12-07 01:33:55
问题 I'm trying out the PHP micro Framework Lumen (from laravel). When I set up Lumen and I try to use the php artisan config:cache command like in Laravel, I get this error : [InvalidArgumentException] There are no commands defined in the "config" namespace. So I have problem when I try to deploy the files to server, so I have to change .env file to change the database username and password. This makes me think config is not available in artisan How can I add it to artisan ? 回答1: Yes, you can not

Laravel: changing from Blade to JS frontend framework

旧街凉风 提交于 2019-12-06 16:44:27
I have a Laravel application which is using Blade as the frontend. I'm feeling the better (more future proof) option would be to switch to Angular, Vue or React, (not entirely sure yet which one I will use but that's not the question of this post) I've always thought that the backend code should expose an API in order for these JS frontend frameworks to work. I currently don't expose any sort of API. I basically designed it in the normal way: define route pointing to controller create controller function and direct it to a view create the Blade view Couple of questions: Should I redesign my

Supervisorctl does not auto-restart daemon queue worker when hanging

谁都会走 提交于 2019-12-06 15:02:40
I have supervisorctl managing some daemon queue workers with this configuration : [program:jobdownloader] process_name=%(program_name)s_%(process_num)03d command=php /var/www/microservices/ppsatoms/artisan queue:work ppsjobdownloader --daemon --sleep=0 autostart=true autorestart=true user=root numprocs=50 redirect_stderr=true stdout_logfile=/mnt/@@sync/jobdownloader.log Sometimes some workers are like hanging (running but stop getting queue messages) and supervisorctl does not automatically restart them, so I have to monitor and manually restart them. Is there something wrong with the

laravel/lumen-framework:“5.7.*” and flipbox/lumen-generator:“^5.6” Class Not Found

被刻印的时光 ゝ 提交于 2019-12-06 15:01:13
问题 I think this is related to composer autoload not detecting packages outside laravel/lumen-framework/src Is my above assumption to the below problem correct? Shall I include psr-4 key inside "autoload-dev" nested object? I really appreciate your help. Thanks. Below is Error Exception, composer.json snippet and Stack Trace Logs Below composer.json { ... "autoload": { "classmap": [ "database/seeds", "database/factories" ], "psr-4": { "App\\": "app/" } }, "autoload-dev": { "classmap": [ "tests/"

Playing Video - Server is not correctly configured - 12939

核能气质少年 提交于 2019-12-06 13:32:29
I have an ios app with laravel (lumen) on the server side. I am trying to play the videos in the server, on application. I am using a Player that plays videos with a direct link (e.g vine video link), however when I save the same vine video on my local server, the application doesn't play the video. In fact, when I try the video with my api route, surprisingly it plays the video on Chrome! But on the application end, I receive error: The server is not correctly configured - 12939 (Please note that if I copy the same mp4 file into the xCode project, add it on 'copy bundle resources', and try

lumen-phpunit 单元测试

有些话、适合烂在心里 提交于 2019-12-06 10:30:49
lumen-框架5.8为例 1,把vendor下的bin目录放到环境变量里面; 2,设置路由 $router->get('syn', ['uses' => 'syn\syn@dictionaryOptions',]); 3,在test目录下 ExampleTest文件里的 testExample方法下做实验 目标1: 测试接口返回值    //测试返回值 和自己预先设定的值是否相等 //$a = $this->get('syn'); 调用设置的路由 //print_r(($a->response));die; 打印路由返回值 //print_r(json_decode($a->response->getContent(),true));die; //查看返回的数据; //判断返回值是否相等 //$this->assertEquals( // [], $this->response->getContent() //); 目标2: 测试接口返回值里面有没有自己想要的数据 //$this->json('get', 'syn' )->seeJson(['msg' => 'success',]); //部分匹配      如:返回的是个json数组['a'=>1,'b'=>2] ;如果在seeJson里面的数组里面有['a'=>1]或者['b'=>2]之一 就验证成功 //$this-

Lumen installation error

倾然丶 夕夏残阳落幕 提交于 2019-12-06 07:02:33
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\Concerns{closure}() in RoutesRequests.php line 624 at Application->sendThroughPipeline(array(), object

upload image ionic 3

不羁岁月 提交于 2019-12-06 05:20:39
I am developing an app in ionic 3 and need to upload image to server using an api created in lumen framework. The request to upload image is : The image is clicked from camera and converted to base64. let base64Image = 'data:image/jpeg;base64,' + imageData; Then i use FileUpload to upload image import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/file-transfer'; buildHeadersDeals(){ this.header = new Headers(); this.header.append('Authorization', 'Basic ' +btoa("test:test")); } uploadPhoto(image, token) { this.buildHeadersDeals(); url = 'http://192.168.2.12/api

Lumen error when using artisan migrate

瘦欲@ 提交于 2019-12-05 16:40:25
I'm new to Lumen and when I try to use: php artisan migrate I get the following error. [PDOException] SQLSTATE[HY000] [2002] No such file or directory If I change 'localhost' to '127.0.0.1' I get this error: [PDOException] SQLSTATE[HY000] [2002] Connection refused If I use: php artisan migrate --database=Lumen I get: [InvalidArgumentException] Database [Lumen] not configured. Here is my .env file DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=Lumen DB_USERNAME=root DB_PASSWORD=root I've read other questions on stack overflow and have tried the solutions i.e. configuring php

Method addEagerConstraints does not exist

99封情书 提交于 2019-12-05 08:54:24
I have two models, User and Event. I made a pivot table, invitations between User and Event with a status column. In my Event model definition, I wrote this : public function invited() { return $this->belongsToMany(User::class, 'invitations', 'event_id', 'user_id') ->withTimestamps() ->withPivot('status') ->orderByDesc('invitations.updated_at'); } public function participants() { $event = $this->with([ 'invited' => function ($query) { $query->where('invitations.status', InvitationStatus::ACCEPTED)->get(); } ])->first(); return $event->invited; } But when in my controller I do : $event = Event: