Return result after the event is fired in Laravel 5.2
<p><strong>My original code is below</strong></p>

<pre><code>/*
   Create the Role
*/  

$result = (new RoleDb())-&gt;Create($obj);

if($result["Success"]) {

    /*
    | Get all Modules 
    */

    $Permissions = $this-&gt;Module-&gt;All($obj-&gt;RoleID);
    $list = [];

    /*
    | Prepare the list that will be assigned to Newly created role.
    */

    foreach($Permissions["Data"] as $Permission) {
        $RolePermissionOM = new RolePermissionOM();
        $RolePermissionOM-&gt;PermissionID             = $Permission-&gt;PermissionID;
        $RolePermissionOM-&gt;IsActive                 = $Permission-&gt;DefaultPermission;
        $RolePermissionOM-&gt;RoleID                   = $result["Data"];
        array_push($list, $RolePermissionOM);
    }

    /*
    | Create default permissions for above created role.
    */

    return $this-&gt;RolePermission-&gt;CreateDefaultPermissions($list, $result["Data"]);
}
</code></pre>

<p>Now, in my application, there are 3 more points where role is being created and instead of code duplication, I though to convert this code into event. SO whenever a role is being created, an Event is being fired to create the permission records for that role.I wrote the below code.</p>

<pre><code>Event::fire(new RoleCreationEvent($result));
// `$result` contains the newly created RoleID.
</code></pre>

<p><strong>Question</strong> : In my original code, I was able to get the result to check if the permissions are saved correctly or not. How will I do that in case of firing the Event ?</p>

<p><strong>Event Code</strong></p>

<pre><code>class RolePermissionEvent extends Event
{
    use SerializesModels;

    public function __construct($RoleID, $Module, $RolePermission)
    {

        $Permissions = $Module-&gt;All($RoleID);
        $list = [];

        foreach($Permissions["Data"] as $Permission) {
            $RolePermissionOM = new RolePermissionOM();
            $RolePermissionOM-&gt;PermissionID = $Permission-&gt;PermissionID;
            $RolePermissionOM-&gt;RoleID       = $RoleID;
            array_push($list, $RolePermissionOM);
        }

        return $RolePermission-&gt;CreateDefaultPermissions($list, $RoleID);
    }
}
</code></pre>