-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make event to work with membership table
- Loading branch information
Showing
5 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use App\Models\Membership; | ||
use Illuminate\Broadcasting\Channel; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Broadcasting\PresenceChannel; | ||
use Illuminate\Broadcasting\PrivateChannel; | ||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class AddMembership | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
public Membership $membership; | ||
|
||
|
||
/** | ||
* Create a new event instance. | ||
*/ | ||
public function __construct(Membership $membership) | ||
{ | ||
$this->membership = $membership; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Listeners; | ||
|
||
use App\Events\AddMembership; | ||
use App\Jobs\EduGainAddEntity; | ||
use App\Jobs\FolderAddEntity; | ||
use App\Models\Entity; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Queue\InteractsWithQueue; | ||
use Illuminate\Support\Facades\Log; | ||
|
||
class SendNewMemberToSaveJob | ||
{ | ||
/** | ||
* Create the event listener. | ||
*/ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Handle the event. | ||
*/ | ||
public function handle(AddMembership $event): void | ||
{ | ||
$entityId = $event->membership->entity_id; | ||
$entity = Entity::find($entityId); | ||
|
||
|
||
if ($entity->approved == 1 && $event->membership->approved == 1 ) { | ||
Log::info(" dispatch FolderAddEntity from Listener SendNewMemberToSaveJob"); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters