Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace AppObservers;
- class SubjectObserver {
- private $shouldUpdateThreads = false;
- /**
- * Listen to the ThreadList created event.
- * This events Fire when ThreadList is handled
- * @param AppObserversAppThreadList $threadList
- */
- public function created(subject $subject) {
- }
- /**
- * Listen to the ThreadList saved event.
- * @param AppObserversAppThreadList $threadList
- */
- public function saved(subject $subject) {
- }
- /**
- * Handling subject updated event
- * Used to update the threads and related models
- * @param subject $subject
- */
- public function updated(subject $subject) {
- info('After Update Event ' . $this->shouldUpdateThreads);
- if ($this->shouldUpdateThreads) {
- info_plus($subject);
- }
- info('After Update Check');
- }
- /**
- * Handling subject being updated event
- * Used to check if the teachers data has changed or not
- * @param subject $subject
- */
- public function updating(subject $_subject) {
- $subject = subject::find($_subject->id);
- $this->shouldUpdateThreads = ($subject->teacherId != $_subject->teacherId) ? true : false;
- info(($subject->teacherId != $_subject->teacherId));
- info("Thread update ? " . $this->shouldUpdateThreads);
- }
- public function deleted(subject $subject) {
- info("Subject deleted");
- }
- }
- $subject->getOriginal('teacher_id');
- public function updated(subject $subject) {
- info('After Update Event ' . $this->shouldUpdateThreads);
- if ($subject->getOriginal('teacher_id') !== $subject->teacher_id) {
- info_plus($subject);
- }
- info('After Update Check');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement