GithubHelp home page GithubHelp logo

Comments (7)

masterix21 avatar masterix21 commented on June 27, 2024 4

@ChrisCook1906, I tried but seems that works like a charm. What am I wrong?

// app/console/Kernel.php
protected function schedule(Schedule $schedule)
{
    if (Tenant::current()) {
        $schedule->job(TenantNoopJob::class)->everyMinute();
        return;
    }

    $schedule->job(LandlordNoopJob::class)->everyMinute();
}
//
// TenantNoopJob
class TenantNoopJob implements ShouldQueue, TenantAware
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public function handle()
    {
        Log::info('TenantNoopJob - '. Tenant::current()->domain .' - '. now());
    }
}

// 
// LandlordNoopJob
class LandlordNoopJob implements ShouldQueue, NotTenantAware
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public function handle()
    {
        Log::info('LandlordNoopJob - '. now());
    }
}

example

from laravel-multitenancy.

masterix21 avatar masterix21 commented on June 27, 2024

Hi @ChrisCook1906, how does scheduled your jobs? All jobs are scheduled using the Laravel default logic (tenant not-aware). Have you implemented a logic that replaces the original one? Please post your code to help me to understand. Thanks

from laravel-multitenancy.

ChrisCook1906 avatar ChrisCook1906 commented on June 27, 2024

I'm running the standard Scheduler function in App/Console/Kernel:
protected function schedule(Schedule $schedule) { $schedule->job(new UpdateMatrix())->hourly(); }

The job, UpdateMatrix, has the proper TenantAware function implemented. All of my other queued jobs are working correctly, except for those dispatched via the Schedule function in (App/Console/Kernel).

from laravel-multitenancy.

masterix21 avatar masterix21 commented on June 27, 2024

Ok, sorry for my questions but I'd like to understand: in your UpdateMatrix do you use Tenant::makeCurrent()?

from laravel-multitenancy.

ChrisCook1906 avatar ChrisCook1906 commented on June 27, 2024

No. In the UpdateMatrix job, I implement the following:
use Spatie\Multitenancy\Jobs\TenantAware;

class UpdateMatrix implements ShouldQueue, TenantAware {......}

from laravel-multitenancy.

masterix21 avatar masterix21 commented on June 27, 2024

@ChrisCook1906, do you have found a solution to the issue?

from laravel-multitenancy.

ChrisCook1906 avatar ChrisCook1906 commented on June 27, 2024

@masterix21 Yes. Thank you.

from laravel-multitenancy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.