Coder Social home page Coder Social logo

Comments (4)

roulendz avatar roulendz commented on July 22, 2024

Is what I am doing, the right path at least?

from notify-plugin.

LukeTowers avatar LukeTowers commented on July 22, 2024

@roulendz have you tried attaching other listeners to that event to see if it is firing as expected?

from notify-plugin.

roulendz avatar roulendz commented on July 22, 2024

So now I got to work, but still hard to understand few things!

Where I can change who will be notified? 'notifiable_id'
For example:
My model Appointment - stores 'student_id' and 'teacher_id' and there is relations Appointment::student and Appointment::teacher!

So I when: When a student books Appointment to the teacher, I want to notify the teacher, that student booked appointment with here.

I cannot figure how to overwrite that, because I all the time I get stored Auth user ID in 'notifiable_id'.

I tried in
SaveDatabaseAction.php change

    /**
     * Triggers this action.
     * @param array $params
     * @return void
     */
    public function triggerAction($params)
    {
        if (
            (!$definition = array_get($this->tableDefinitions, $this->host->related_object)) ||
            (!$param = array_get($definition, 'param')) ||
            (!$value = array_get($params, $param))
        ) {
            throw new ApplicationException('Error evaluating the save database action: the related object is not found in the action parameters.');
        }

        if (!$value instanceof EloquentModel) {
            // @todo Perhaps value is an ID or a model array,
            // look up model $definition[class] from ID ...
        }

        $rule = $this->host->notification_rule;

        $relation = array_get($definition, 'relation');

        $value->$relation()->create([
            'id' => Uuid::uuid4()->toString(),
            'event_type' => $rule->getEventClass(),
            'icon' => $this->host->icon ? $this->host->icon : 'icon-list-alt',
            'notifiable_id' => $param['notifiable_id'],
            'type' => $this->host->type,
            'body' => 'Student booked appointment',
            'data' => $this->getData($params),
            'read_at' => null,
        ]);
    }

buts till no luck.

Any suggestions.

from notify-plugin.

daftspunk avatar daftspunk commented on July 22, 2024

If you still need support with this, feel free to send us an email.

from notify-plugin.

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.