Category : lumen

I am trying to transfer file through FTP . First of all I converted base64 data to blob then tried to transfer through FTP . Here my input data is base64 image. but getting Class ‘LeagueFlysystemAdapterFtp’ not found error. Here I am sharing my code use IlluminateSupportFacadesStorage; $base_64_data = $request->get(‘profile_pic’); // Ex: /9j/4AAQSkZJRgABAQAAAQABAAD……. $dir = ..

Read more

I was testing my model relationships using this tutorial. Here are the models I wanted to test: class Concert extends Model { use HasFactory; protected $dates = [ ‘date’ ]; protected $primaryKey = ‘date’; protected $keyType = ‘date’; protected $table = ‘concerts’; public function recordings(): HasMany { return $this->hasMany(ConcertRecording::class, ‘concert_date’, ‘date’); } public function date() ..

Read more

I am having an issue with an app created in Lumen and Guzzlehttp requests. Looks like I cannot pass options like JSON_UNESCAPED_SLASHES whenever I am doing a request: $response = (new Client())->request($this->typeRequest, $endpoint, $options); This is hitting my server with unescaped slashes and causing some troubles. Everything seems to be related with the vendor/guzzlehttp/guzzle/src/Client.php into ..

Read more

I’ve been trying to implement auth 0 to my Lumen API following this blog But I got this response {message: "insufficient scope"} I guess I put the parameter correctly in /routes/web.php which is ‘read:me’ $router->group([‘middleware’ => ‘auth’, ‘prefix’ => ‘api’], function () use ($router) { $router->get(‘me’, [‘middleware’ => ‘read:me’, ‘uses’ => ‘[email protected]’]); }); as in ..

Read more

I have these two Models : Club.php class Club extends Model implements AuthenticatableContract, AuthorizableContract, JWTSubject { use Authenticatable, Authorizable; // because name of the class != table name protected $table = ‘sf_club’; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ ‘login’, ’email’, ‘nom_equipe’, ‘avatar’, ‘nation_id’, ‘argent’, ..

Read more

I’m using Lumen 8.3 ,wanted to use factory() function in my tests, it gives me Undefined Function ,there is nothing useful in the Docs of Lumen Am i missing something here? class ProductTest extends TestCase { public function test_if_can_send_products_list(){ $products = factory(‘App/Products’,5)->make(); $this->json(‘post’,’/payouts’,$products) ->seeJson([ ‘created’ => true, ]); } } -> Error: Call to undefined ..

Read more

I’m trying to implement RabbitMQ on Laravel Lumen (ver 8) And I’ve installed the following third-party library and configured based on the documentation. Library: https://github.com/vyuldashev/laravel-queue-rabbitmq After adding the changes I’m getting the error when executing the queue worker command (php artisan queue:work/php artisan rabbitmq:consume) In StreamIO.php line 181: Error receiving data I’ve tried with "Amazon ..

Read more

How to call a method, function or initialize class after an middleware in a controller constructor in Laravel? I try initialize class Translator after middleware(‘lang’), but class Translator initialized before execute middleware(‘lang’). Controllers/IndexController.php <?php namespace AppHttpControllers; use LaravelLumenRoutingController; use AppHelpersTranslator; class IndexController extends Controller { private $transhome; public function __construct() { $this->middleware(‘lang’); $this->transhome = new ..

Read more

I am facing a strange issue while setting up routes. Laravel does not differentiate between the following routes. 1: $router->get(‘/quotations/photos/{id}{/version}’, [‘uses’=>’[email protected]’]); 2: $router->post(‘/quotations/photos/{id}/{version}’, [‘uses’=>’[email protected]’]); Where route 3 is an example. If route 1 is defined then Laravel assumes route 3 as a duplicate entry. I am facing the same issue with defined routes in the ..

Read more

Using Lumen 5.5, PHP 7.3 My goal is to extend existing functionality on a model while maintaining code cleanliness. Using the Event/Listener pattern made sense but I’m hitting some design issues where I need access to the original state of the model down in the listener. That state doesn’t appear to be accessible. How It ..

Read more

I have one event with two listeners. I need to stop listener propagation when the first listener fails. For example: Event: RegisterUserEvent Listeners: StoreUserListener and SendVerificationEmailListener If, for any reason, the user can’t be stored in database, I want that SendVerificationEmailListener doesn’t execute. I’m I using Lumen 8.x and the events are processed with Redis. ..

Read more

I’m trying to implement an operation that will be called from a calculator in Angular and then store records of the mathematical operations performed in a SQL table as soon as the button are clicked. I need help with the following code, I’m very new in PHP. CalculatorController { add(): JsonResponse subtract(): JsonResponse multiply(): JsonResponse ..

Read more

I have created Index whenever a user is created. PHP code $params = [ ‘index’ => ‘my_index’, ‘body’ => [ ‘settings’ => [ ‘analysis’ => [ ‘analyzer’ => [ ‘filter’ => [‘lowercase’] ] ], ‘mappings’ => [ ‘meta’ => [ ‘properties’ => [ ‘first_name’ => [ ‘type’ => ‘keyword’ ], ‘age’ => [ ‘type’ => ..

Read more