spbaniya

spbaniya

Software Engineer at Edelberg & Associates, Intergo Telecom

Member Since 2 Months Ago

Pokhara

Experience Points
830
Total
Experience

4,170 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
830 XP
Apr
06
17 hours ago
Activity icon

Started a new Conversation Simultaneous Update Of A Field From Multiple Service Doesn't Work

I'm using two servers to update balance of a user simultaneously. Both servers uses same db.

Endpoint1: test-balance-add on server 1 to increment balance by 1 in a loop of 1000

Route::get('test-balance-add', function() {
    $user = auth()->user();
    $remote = $user->user_remote;
    for($i = 0; $i<1000; $i++)
    {

        $remote->cash_balance += 1;
        $remote->save();
    }
    dd($remote->cash_balance);

});

Endpoint2: test-balance-update on server 2 to decrease balance by 100

$router->get('/test-balance-update', function(\Illuminate\Http\Request $request) {
        DB::transaction(function() use ($request) {
            $remote = \App\Models\User::where('id', $request->user->_id)->first();
            $remote->cash_balance -= 100;
            $remote->save();
        });
        $remote = \App\Models\User::where('id', $request->user->_id)->first();
        dd($remote->cash_balance);
    });

Endpoint3: test-balance-zero on server 2 to make balance 0

$router->get('/test-balance-zero', function(\Illuminate\Http\Request $request) {
        DB::transaction(function() use ($request) {
            $remote = \App\Models\User::sharedLock()->where('id', $request->user->_id)->first();
            $remote->cash_balance = 0;
            $remote->save();
        });
        $remote = \App\Models\User::where('id', $request->user->_id)->first();
        dd($remote->cash_balance);
    });

I ran Endpoint3 to make balance to 0. Then I ran Endpoint1 and after a second I ran Endpoint2

I ran above with transaction and lockForUpdate on all endpoints but still the same issue as below.

Here I should expect final balance of 900. But I'm seeing 1000 which is wrong.

Why is this happening? How can I make it work?

Apr
03
3 days ago
Activity icon

Started a new Conversation How To Check If Db Table Or Row Is Locked?

Is there any mechanism in laravel to check if there's any lock on table row and wait until the lock is released?

Mar
30
1 week ago
Activity icon

Replied to Hook A Route Middleware Or Event Without Touching Route

@tykus For routes that I could not change the definition or I would not change the definition. For e.g. routes from vendor packages

Actually I found the answer,

Event::listen(RouteMatched::class, function (RouteMatched $r) { // $r has Route and Request
        dd($r->route->getName());
});

with above, I can apply the extra piece of code.

Activity icon

Replied to Hook A Route Middleware Or Event Without Touching Route

@tykus Yes middleware or event are two different concepts. Here, I want to execute some piece of code (by any means) without changing the controller or route. I was wondering if there's any global route event listener in laravel framework where I could apply the piece of code without any need to change existing code.

@siangboon I do not want to change the controller structure at all. How would it be possible to inject in the constructor without changing the controller file?

Activity icon

Started a new Conversation Hook A Route Middleware Or Event Without Touching Route

Is it possible to hook any middleware or event without touching the actual route?

Say, I've route:

Route::any('/get-callback', '[email protected]')->name('callback')

in a package.

So I want to trigger some piece of code without changing the definition of route or controller action whenever there's a request on above route

Activity icon

Replied to Package Config File Is Appending `php`

@bobbybouwmann @jlrdw It was my mistake

$this->mergeConfigFrom(__DIR__ . '/../config/messenger.php', 'messenger');

Instead of above, I was using

$this->mergeConfigFrom(__DIR__ . '/../config/messenger.php', 'messenger.php');

Mar
29
1 week ago
Activity icon

Started a new Conversation Package Config File Is Appending `php`

I am creating a package with config file messenger.php I'm trying to access a variable inside messenger.php in a class of the package

return [
    'default' => env('DEFAULT_MESSENGER_DRIVER', 'longcode'),
];

When trying to access messenger.default it's not working because for some reason php appended and have to do messenger.php.default to make it work. Why is this happening?

Mar
13
3 weeks ago
Activity icon

Replied to LazyCollection Not Working As Intended

@snapey @dominict

public static function getContacts($file, $listId)
    {
        return LazyCollection::make(function() use($file, $listId) {
            $f = fopen($file, 'r');

            // read each line of the file without loading the whole file to memory
            while ($line = fgets($f))
            {
                $row = explode(",", $line);

                if (trim(urlencode(strtolower(trim($row[0]))), '%EF%BB%BF') == "phone" || empty(trim($row[0])))
                {
                    continue;
                }
                yield [
                    'phone'     => !empty($row[0]) ? handleInvalidStrings(trim($row[0])) : '',
                    'firstname' => !empty($row[1]) ? handleInvalidStrings(trim($row[1])) : '',
                    'lastname'  => !empty($row[2]) ? handleInvalidStrings(trim($row[2])) : '',
                    'email'     => !empty($row[3]) ? handleInvalidStrings(trim($row[3])) : '',
                    'custom1'   => !empty($row[4]) ? handleInvalidStrings(trim($row[4])) : '',
                    'custom2'   => !empty($row[5]) ? handleInvalidStrings(trim($row[5])) : '',
                    'list_id'   => $listId,
                ];
            }
            fclose($f);
        });
    }

With LazyCollection, with 10K chunk size, I'm dispatching a job where real work is done

Mar
12
3 weeks ago
Activity icon

Replied to How To Use LazyCollection To Merge Duplicate Records?

@spiral You're using dB to identify the duplicates and merge.

My requirement was find the duplicates within CSV and merge them and form LazyCollection for any future use

Mar
10
3 weeks ago
Activity icon

Started a new Conversation LazyCollection Not Working As Intended

$contacts = \App\Helpers\ContactHelper::getContacts(public_path('/file_250k.csv'), 113); // LazyCollection
    $test = $contacts->groupBy('phone')->chunk(20)->each(function ($item, $key) {
        dd($item); // LazyCollection with Collection inside
    });

Why LazyCollection is returning Collection instead of LazyCollection?

Because of that, it's consuming huge memory

https://www.dropbox.com/s/j17x4qh96l0q7jc/Screenshot%202020-03-10%2023.15.08.png?dl=0

Activity icon

Replied to How To Use LazyCollection To Merge Duplicate Records?

@artcore not storing at the moment... just trying to find the duplicates in the uploaded CSV file. It's using the entire memory and ended up with Allowed memory exhausted

Essentially,

// Iterator with 1M records
$test = $contacts->mapToGroups(function($item, $key) {
        return [$item['phone'] => $item];
    })->chunk(20)->each(function($c) {
        dd($c->toArray());
    });

and ended up with Allowed memory size of 134217728 bytes exhausted (tried to allocate 33554440 bytes)

I do not want to increase the memory...

Activity icon

Started a new Conversation How To Use LazyCollection To Merge Duplicate Records?

I'm trying to use LazyCollection to import a CSV with email, first_name, last_name, phone. CSV can have millions of records.

return LazyCollection::make(function() use ($file, $listId) {
            $f = fopen($file, 'r');

            // read each line of the file without loading the whole file to memory
            while ($line = fgets($f))
            {
                $row = explode(",", $line);

                if (trim(urlencode(strtolower(trim($row[0]))), '%EF%BB%BF') == "phone")
                {
                    continue;
                }
                yield [
                    'phone'     => !empty($row[0]) ? handleInvalidStrings(trim($row[0])) : '',
                    'firstname' => !empty($row[1]) ? handleInvalidStrings(trim($row[1])) : '',
                    'lastname'  => !empty($row[2]) ? handleInvalidStrings(trim($row[2])) : '',
                    'email'     => !empty($row[3]) ? handleInvalidStrings(trim($row[3])) : '',
                    'custom1'   => !empty($row[4]) ? handleInvalidStrings(trim($row[4])) : '',
                    'custom2'   => !empty($row[5]) ? handleInvalidStrings(trim($row[5])) : '',
                    'list_id'   => $listId,
                ];
            }
        });

There can also be duplicate email entries with different first_name or last_name or phone.

I tried to use groupBy('email') but then I can't apply any other functions like: ->count() or ->each() or ->take(1) and ended up with Allowed memory exhausted

What is the better approach to handle 1M records gracefully?

Mar
09
4 weeks ago
Activity icon

Replied to How To Pause/resume Queues On-demand?

@bobbybouwmann How below scenario could be handled?

User A sent 10K Emails to queue accidentally. 1K is consumed by workers. User B, C, D sent some Emails on same queue.

Now 9K Emails on Job needs to be stopped User A.

Mar
08
4 weeks ago
Activity icon

Replied to Application Not Working When Using Custom Service Provider

@snapey @ricus I removed the files and re-added them.... out of wonder it's working now... Thanks for the suggestions

Activity icon

Replied to Application Not Working When Using Custom Service Provider

\Sujit\NumberService\NumberServiceProvider::class,

Activity icon

Replied to Application Not Working When Using Custom Service Provider

app.php

<?php

use Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider;

return [

    /*
    |--------------------------------------------------------------------------
    | Application Name
    |--------------------------------------------------------------------------
    |
    | This value is the name of your application. This value is used when the
    | framework needs to place the application's name in a notification or
    | any other location as required by the application or its packages.
    */

    'name' => env('APP_NAME', 'Sujit'),

    /*
    |--------------------------------------------------------------------------
    | Application Environment
    |--------------------------------------------------------------------------
    |
    | This value determines the "environment" your application is currently
    | running in. This may determine how you prefer to configure various
    | services your application utilizes. Set this in your ".env" file.
    |
    */

    'env' => env('APP_ENV', 'production'),

    /*
    |--------------------------------------------------------------------------
    | Application Debug Mode
    |--------------------------------------------------------------------------
    |
    | When your application is in debug mode, detailed error messages with
    | stack traces will be shown on every error that occurs within your
    | application. If disabled, a simple generic error page is shown.
    |
    */

    'debug' => env('APP_DEBUG', false),

    /*
    |--------------------------------------------------------------------------
    | Application URL
    |--------------------------------------------------------------------------
    |
    | This URL is used by the console to properly generate URLs when using
    | the Artisan command line tool. You should set this to the root of
    | your application so that it is used when running Artisan tasks.
    |
    */

    'url'        => env('APP_URL', 'http://localhost'),
    'domain'     => env('APP_DOMAIN', 'localhost'),
    'api_domain' => env('CUSTOMER_API_DOMAIN', 'localhost'),

    /*
    |--------------------------------------------------------------------------
    | Application Timezone
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default timezone for your application, which
    | will be used by the PHP date and date-time functions. We have gone
    | ahead and set this to a sensible default for you out of the box.
    |
    */

    'timezone' => 'UTC',

    /*
    |--------------------------------------------------------------------------
    | Application Locale Configuration
    |--------------------------------------------------------------------------
    |
    | The application locale determines the default locale that will be used
    | by the translation service provider. You are free to set this value
    | to any of the locales which will be supported by the application.
    |
    */

    'locale' => 'en',

    /*
    |--------------------------------------------------------------------------
    | Application Fallback Locale
    |--------------------------------------------------------------------------
    |
    | The fallback locale determines the locale to use when the current one
    | is not available. You may change the value to correspond to any of
    | the language folders that are provided through your application.
    |
    */

    'fallback_locale' => 'en',

    /*
    |--------------------------------------------------------------------------
    | Encryption Key
    |--------------------------------------------------------------------------
    |
    | This key is used by the Illuminate encrypter service and should be set
    | to a random, 32 character string, otherwise these encrypted strings
    | will not be safe. Please do this before deploying an application!
    |
    */

    'key' => env('APP_KEY'),
    'auth_key' => env('AUTH_KEY'),
    'registration_key' => env('REGISTRATION_ACCESS_KEY'),

    'cipher' => 'AES-256-CBC',

    /*
      Cost of each credit
    */

    'cost_per_credit' => env('COST_PER_CREDIT', 0.01),

    /*
    |--------------------------------------------------------------------------
    | Autoloaded Service Providers
    |--------------------------------------------------------------------------
    |
    | The service providers listed here will be automatically loaded on the
    | request to your application. Feel free to add your own services to
    | this array to grant expanded functionality to your applications.
    |
    */

    'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,
        Illuminate\Cache\CacheServiceProvider::class,
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
        Illuminate\Cookie\CookieServiceProvider::class,
        Illuminate\Database\DatabaseServiceProvider::class,
        Illuminate\Encryption\EncryptionServiceProvider::class,
        Illuminate\Filesystem\FilesystemServiceProvider::class,
        Illuminate\Foundation\Providers\FoundationServiceProvider::class,
        Illuminate\Hashing\HashServiceProvider::class,
        Illuminate\Mail\MailServiceProvider::class,
        Illuminate\Notifications\NotificationServiceProvider::class,
        Illuminate\Pagination\PaginationServiceProvider::class,
        Illuminate\Pipeline\PipelineServiceProvider::class,
        Illuminate\Queue\QueueServiceProvider::class,
        Illuminate\Redis\RedisServiceProvider::class,
        Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
        Illuminate\Session\SessionServiceProvider::class,
        Illuminate\Translation\TranslationServiceProvider::class,
        Illuminate\Validation\ValidationServiceProvider::class,
        Illuminate\View\ViewServiceProvider::class,

        /*
         * Package Service Providers...
         */
        Laravel\Tinker\TinkerServiceProvider::class,
        Laravel\Socialite\SocialiteServiceProvider::class,

        /*
         * Application Service Providers...
         */
        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        App\Providers\ComposerServiceProvider::class,
//        App\Providers\BroadcastServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        //App\Providers\TelescopeServiceProvider::class,
        App\Providers\RouteServiceProvider::class,

        App\Providers\SmsBraintreeServiceProvider::class, // braintree
        // App\Providers\GeoIp2ServiceProvider::class,
        Mannysoft\GeoIp2Country\ServiceProvider::class,

        // Mannysoft\VatLayer\ServiceProvider::class,
        Dingo\Api\Provider\LaravelServiceProvider::class,
        // Artdarek\OAuth\OAuthServiceProvider::class,
        // Mpociot\ApiDoc\ApiDocGeneratorServiceProvider::class,
        Collective\Html\HtmlServiceProvider::class,
        // PragmaRX\Firewall\Vendor\Laravel\ServiceProvider::class,


        Creativeorange\Gravatar\GravatarServiceProvider::class,
        Maatwebsite\Excel\ExcelServiceProvider::class,
        // Propaganistas\LaravelPhone\PhoneServiceProvider::class,
        // Propaganistas\LaravelIntl\IntlServiceProvider::class,
        // Barryvdh\Cors\ServiceProvider::class,
        // Mannysoft\SMS\SMSServiceProvider::class,
        \App\Providers\SMSServiceProvider::class,
        // Jenssegers\Agent\AgentServiceProvider::class,
        // Kyslik\ColumnSortable\ColumnSortableServiceProvider::class,

        // bugsnag

        \Bugsnag\BugsnagLaravel\BugsnagServiceProvider::class,


        // zip
        // 'Chumper\Zipper\ZipperServiceProvider',

        Aws\Laravel\AwsServiceProvider::class,

        AlbertCht\InvisibleReCaptcha\InvisibleReCaptchaServiceProvider::class,

        // paypal
        Srmklive\PayPal\Providers\PayPalServiceProvider::class,

        // pdf
        Barryvdh\DomPDF\ServiceProvider::class,
        LaravelLogViewerServiceProvider::class,

        \App\Providers\AuthApiServiceProvider::class,

        // TPWeb\Vat\VatServiceProvider::class,
        // \Module\Account\Providers\AccountServiceProvider::class

        \Sujit\NumberService\NumberServiceProvider::class,
    ],

    /*
    |--------------------------------------------------------------------------
    | Class Aliases
    |--------------------------------------------------------------------------
    |
    | This array of class aliases will be registered when this application
    | is started. However, feel free to register as many as you wish as
    | the aliases are "lazy" loaded so they don't hinder performance.
    |
    */

    'aliases' => [

        'App'          => Illuminate\Support\Facades\App::class,
        'Artisan'      => Illuminate\Support\Facades\Artisan::class,
        'Auth'         => Illuminate\Support\Facades\Auth::class,
        'Blade'        => Illuminate\Support\Facades\Blade::class,
        'Broadcast'    => Illuminate\Support\Facades\Broadcast::class,
        'Bus'          => Illuminate\Support\Facades\Bus::class,
        'Cache'        => Illuminate\Support\Facades\Cache::class,
        'Config'       => Illuminate\Support\Facades\Config::class,
        'Cookie'       => Illuminate\Support\Facades\Cookie::class,
        'Crypt'        => Illuminate\Support\Facades\Crypt::class,
        'DB'           => Illuminate\Support\Facades\DB::class,
        'Eloquent'     => Illuminate\Database\Eloquent\Model::class,
        'Event'        => Illuminate\Support\Facades\Event::class,
        'File'         => Illuminate\Support\Facades\File::class,
        'Gate'         => Illuminate\Support\Facades\Gate::class,
        'Hash'         => Illuminate\Support\Facades\Hash::class,
        'Lang'         => Illuminate\Support\Facades\Lang::class,
        'Log'          => Illuminate\Support\Facades\Log::class,
        'Mail'         => Illuminate\Support\Facades\Mail::class,
        'Notification' => Illuminate\Support\Facades\Notification::class,
        'Password'     => Illuminate\Support\Facades\Password::class,
        'Queue'        => Illuminate\Support\Facades\Queue::class,
        'Redirect'     => Illuminate\Support\Facades\Redirect::class,
        'Redis'        => Illuminate\Support\Facades\Redis::class,
        'Request'      => Illuminate\Support\Facades\Request::class,
        'Response'     => Illuminate\Support\Facades\Response::class,
        'Route'        => Illuminate\Support\Facades\Route::class,
        'Schema'       => Illuminate\Support\Facades\Schema::class,
        'Session'      => Illuminate\Support\Facades\Session::class,
        'Storage'      => Illuminate\Support\Facades\Storage::class,
        'URL'          => Illuminate\Support\Facades\URL::class,
        'Validator'    => Illuminate\Support\Facades\Validator::class,
        'View'         => Illuminate\Support\Facades\View::class,

        'SmsBraintree' => App\Facades\SmsBraintreeFacade::class,
        'Socialite'    => Laravel\Socialite\Facades\Socialite::class,
        // 'VatLayer'     => Mannysoft\VatLayer\Facades\VatLayerFacade::class,
        'JWTAuth'      => Tymon\JWTAuth\Facades\JWTAuth::class,
        'JWTFactory'   => Tymon\JWTAuth\Facades\JWTFactory::class,
        'OAuth'        => Artdarek\OAuth\Facade\OAuth::class,
        'Form'         => Collective\Html\FormFacade::class,
        'Html'         => Collective\Html\HtmlFacade::class,
        // 'Firewall' => PragmaRX\Firewall\Vendor\Laravel\Facade::class,

        'Gravatar'      => Creativeorange\Gravatar\Facades\Gravatar::class,
        'Excel'         => Maatwebsite\Excel\Facades\Excel::class,
        'Omnipay'       => 'Ignited\LaravelOmnipay\Facades\OmnipayFacade',
        'SMS'           => \App\Services\MessageManager\Facades\SMS::class,
        // 'GeoIp2Country' => App\Facades\GeoIp2CountryFacade::class,
        'GeoIp2Country' => Mannysoft\GeoIp2Country\Facades\Facade::class,
        // 'Agent' => Jenssegers\Agent\Facades\Agent::class,

        // Bugsnag
        'Bugsnag'       => \Bugsnag\BugsnagLaravel\Facades\Bugsnag::class,


        // zip
        'Zipper'        => 'Chumper\Zipper\Zipper',

        'AWS'    => Aws\Laravel\AwsFacade::class,

        // paypal
        'PayPal' => Srmklive\PayPal\Facades\PayPal::class,

        // pdf
        'PDF'    => Barryvdh\DomPDF\Facade::class,

        'Vat' => TPWeb\Vat\VatFacade::class,
    ],

];
Activity icon

Replied to Application Not Working When Using Custom Service Provider

@ricus Yes that's the weird thing... When I comment the line on app.php on providers array, everything works as previous

Content of NumberServiceProvider:

<?php

namespace Sujit\NumberService;

use Illuminate\Support\ServiceProvider;

class NumberServiceProvider extends ServiceProvider
{
    public function register()
    {

    }

    public function boot()
    {

    }
}
Activity icon

Started a new Conversation Application Not Working When Using Custom Service Provider

I'm using laravel 6.15, I've created a ServiceProvider: /modules/NumberService/src/NumberServiceProvider.php, I've also added autoload:

"autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/",
            "Sujit\\NumberService\\": "modules/NumberService/src/"
        }
    }

and did composer dumpautoload

After that, I added NumberServiceProvider::class on app.php

but I'm getting following error:

Illuminate \ Contracts \ Container \ BindingResolutionException
Target class [bugsnag] does not exist.
Previous exceptions
Class bugsnag does not exist (-1)

It seems for some reason the Facades are not working...

Please suggest me what am I doing wrong

Activity icon

Started a new Conversation How To Pause/resume Queues On-demand?

Is it possible to pause and resume the queues on-demand? Also, is it possible to conditionally pause and resume the waiting jobs that are already on queue?

Mar
04
1 month ago
Mar
01
1 month ago
Activity icon

Started a new Conversation How To Retry A Failed Job To Another Queue Name?

I'm using https://github.com/vyuldashev/laravel-queue-rabbitmq to implement RabbitMQ for queue. I want to retry the failed job (dispatched on abc queue) to another queue (xyz)

How would I do this?

Feb
13
1 month ago
Activity icon

Replied to Cannot Retry Previously Timeout Job

@bobbybouwmann If you see this URL: https://i.imgur.com/6yf7osA.png there are 3 such Jobs that never success

Activity icon

Replied to Cannot Retry Previously Timeout Job

Yes, I'm confirmed

Activity icon

Replied to Cannot Retry Previously Timeout Job

@bobbybouwmann They failed again within less than a second. I confirmed it as the failed_at timestamp and id of failed job was changed

Feb
12
1 month ago
Activity icon

Replied to Cannot Retry Previously Timeout Job

There are other failed jobs as well. For e.g. Mysql Gone away jobs and when I retry it works completely fine.

I call queue:retry for each individual job retry

Activity icon

Started a new Conversation Cannot Retry Previously Timeout Job

Previously timed out jobs are unable to retry. How should such jobs be retried?

Getting this error

Illuminate\Queue\MaxAttemptsExceededException: App\Jobs\SendJob has been attempted too many times or run too long. The job may have previously timed out.
Jan
23
2 months ago
Activity icon

Started a new Conversation What Is The Best Approach To Do Unit/Feature Testing In Laravel

What is the best approach to do Unit/Feature Testing in following scenario?

  • Have Authenticate Service on Lumen
  • Have Messaging Service with API endpoints exposed for sending emails on Lumen
  • Have Frontend on Laravel for user login from Authenticate Service and using remoteDB of #2 for fetching reports

How would I write testing on #3 that involves remote dB and API endpoints?

How would I test any callbacks from email service provider on #2?

Jan
15
2 months ago
Activity icon

Replied to Getting Error: Cannot Declare Class A Because The Name Is Already In Use

'namespace' => 'Module\' . ucfirst($this->module) . '\Http\Controllers',

Is working fine for me i.e. namespace without \\ at the last

Activity icon

Started a new Conversation Cannot Load Custom Package Blade Files

In ServiceProvider I used:

    public function publishView()
    {
        $this->loadViewsFrom(__DIR__ . '/../../' . ucfirst($this->module) . '/views', $this->module); // $this->module = 'account';
    }

In Controller

public function showLoginForm()
{
    return view('account::auth.login');
}

This is working fine... Now I wanted to include other blade files inside auth.login as:

@include('account::forms.login')

But I'm getting error:

View [forms.login] not found. (View: app/modules/Account/views/auth/login.blade.php)

How can I fix this issue?

Activity icon

Started a new Conversation Getting Error: Cannot Declare Class A Because The Name Is Already In Use

In CustomServiceProvider I added following piece of code:

private function publishRoutes()
    {
        $this->publishWebRoutes();
        $this->publishApiRoutes();
    }
    private function publishWebRoutes()
    {
        $this->loadRoutesFrom(__DIR__ . '/../../' . ucfirst($this->module) . '/routes/web.php');
    }
    private function publishApiRoutes()
    {
        $this->loadRoutesFrom(__DIR__ . '/../../' . ucfirst($this->module) . '/routes/api.php');
    }
    /**
     * Load the standard routes file for the application.
     *
     * @param string $path
     * @return mixed
     */
    protected function loadRoutesFrom($path)
    {
        //dd($this->getNamespace());
        Route::group([
            // 'middleware' => 'api',
            'namespace' => 'Module\' . ucfirst($this->module) . '\Http\Controllers\',
            'prefix' => $this->module,
        ], function ($router) use ($path) {
            require $path;
        });
    }

I defined a route in web.php as

Route::get('test', '[email protected]');

When I tried to run, I'm getting this error:

Symfony\Component\Debug\Exception\FatalErrorExceptionCannot declare class Module\Account\Http\Controllers\AccountController, because the name is already in use

Any idea why am I getting this error? I have not declared AccountController anywhere else.. Also I get same error for any random Controller