Category : lumen

I need to see to all queries that executed in api. I tried 3 ways but none of them work 1: IlluminateSupportFacadesDB::listen(function ($query) { Log::info($query->sql, [‘Bindings’ => $query->bindings, ‘Time’ => $query->time]); }); listen method is not existed. 2: Event::listen(‘IlluminateDatabaseEventsQueryExecuted’, function ($query) { Log::debug($query->sql . ‘ – ‘ . serialize($query->bindings)); }); this one didn’t work too. ..

Read more

I am learning about microservers, splitting an application back-end onto multiple servers and then having a single frontend server. What I am confused about is how I would tie them all together and ensuring users are authenticated before allowing actions on certain services. For instance, if A: auth.mydomain.com manages all of the authentication (with its ..

Read more

I’ve enabled CORS in my nginx and it seems to work OK until I add this peace of code (bolded): public function store(Request $request){ **$validated = $request->validate([ ‘title’ => ‘required|unique:posts|max:255’, ‘file’ => ‘mimes:application/zip,application/x-rar-compressed,application/x-7z-compressed’,** As soon as I add $request->validate() I always get CORS error: Access to XMLHttpRequest at ‘aaa.com/upload’ from origin ‘bbb.com’ has been blocked ..

Read more

I have created a view for lumen with this code: <form action="{{ route(‘extentions.update’, [‘id’=>$extention->id]) }}" class="form" method="POST"> @method(‘PUT’) @include(‘extentions._partials.form’) <button type="submit">Enviar</button> </form> However i am getting the error Call to undefined function method_field() when opening this view, does Lumen not have the @method function? If so, what should I do? Sourc..

Read more

Response API 1 $api1 = [ ‘status’ => ‘success’, ‘item’ => [ [‘judul_kontrak’ => ‘proyek 3’], [‘judul_kontrak’ => ‘proyek 4’], [‘judul_kontrak’ => ‘proyek 5’] ] ]; Response API 2 $api1 = [ ‘status’ => ‘success’, ‘item’ => [ [‘nama_proyek’ => ‘proyek 1’], [‘nama_proyek’ => ‘proyek 2’], [‘nama_proyek’ => ‘proyek 3’] ] ]; i have code ..

Read more

I got several jobs, processing with lumen C:projectsmyproject (feature-1234 -> origin) $ php artisan queue:work –queue=rate-parse,fetch-tickers,check-markets,make-rates,switch-exchange but sometimes, treatment suddenly interrupted without any errors or messages, and not all queues finished [2020-12-16 10:01:21][22152] Processing: AppJobsSwitchExchange [2020-12-16 10:01:34][22152] Processed: AppJobsSwitchExchange C:projectsmyproject (feature-1234 -> origin) Sourc..

Read more

I have the code if there is the same name in 2nd foreach, then the same name is not displayed, but I don’t know how to keep the same name not displayed?. $arr = []; foreach ($respon_tel[‘item’] as $item) { $proyek = [ ‘nama_proyek’ => $item[‘judul_kontrak’], ‘from’ => ‘Another API’ ]; foreach($model as $m){ if(trim(strtolower($item[‘judul_kontrak’])) ..

Read more

in laravel we can use storage Facade in order to save and read files, but in lumen 7.0 there is no filesystem config available at start. what I did so far: composer require league/flysystem in composer.json file, I added the following in autoload section: “files”: [ “app/helpers.php” ], then in app directory, I’ve created helpers.php ..

Read more

I am building a web application using Laravel’s lumen framework. I am writing integration and unit tests for my application. I am using Jobs in my application to do heavy tasks in the background, https://laravel.com/docs/8.x/queues. Normally, within the tests, I fake and assert if the job is pushed into the queue as follow. Queue::fake(); Queue::assertPushed(SendEmails::class); ..

Read more

I’m trying to use a trait inside an helper function but its throwing error like this Using $this when not in object context this is my helper function namespace AppHelpers; use Log; use Exception; use TwilioRestClient; use AppTraitsHelperTrait; class Twilio { use HelperTrait; static function cdata($hApp){ return response()->json($this->notPdResponse($hApp)); } } Sourc..

Read more

I’m using Lumen 8.x. I created a seeder inside a subfolder of database/seeders/. and I created a seeder file inside subfolder. the path database/seeders/tests/TestSeeder.php seeder file <?php namespace DatabaseSeedersTests; class TestSeeder extends BaseSeeder { /** * Run the database seeds. * * @return void */ public function run() { // codes } } composer.json "autoload": ..

Read more

I am working in Lumen app and i have created route group like below, $router->group([‘prefix’ => ‘clare’], function() use ($router) { $router->get(‘routetest’, [‘uses’ => ‘[email protected]’]); }); I want to get the current route prefix in ChannelController index method. I don’t know how to do that. I could not find this in documentation for lumen. But ..

Read more

I’m working on a new lumen project and i’m trying to communicate with it from an angular project. I’ve added a middleware to add the following headers for local requests using a middleware: $response->header(‘Access-Control-Allow-Origin’, ‘*’) ->header(‘Access-Control-Allow-Methods’, ‘GET, POST, PUT, DELETE, OPTIONS’) ->header(‘Access-Control-Allow-Headers’, ‘X-Requested-With, Content-Type, X-Token-Auth, Authorization’); But i still have issue with CORS. localhost/:1 Access ..

Read more