Esempio n. 1
0
 public function index()
 {
     $organizations = Organization::all();
     return view('backend.organizations.index')->with(compact('organizations'));
     // ->withUsers($this->users->getUsersPaginated(config('access.users.default_per_page'), 1));
 }
 /**
  *  Details of the organization to be exported to the csv
  * @return array
  */
 public function getAllOrganizationInfo()
 {
     $organizations = Organization::all();
     $organizationDetails = [];
     $organizations->each(function ($organization) use(&$organizationDetails) {
         $organizationId = $organization->id;
         $organizationDetails[$organizationId]['name'] = $organization->name;
         $organizationDetails[$organizationId]['admin_email'] = $this->getEmailOfOrganizationAdmin($organizationId);
         $activities = $this->getActivitiesData($organizationId);
         $organizationDetails[$organizationId]['noOfActivities'] = $activities ? $activities[0]->noofactivities : ' ';
         $organizationDetails[$organizationId]['activityLastUpdatedAt'] = $activities ? $activities[0]->updated_at : ' ';
         $organizationDetails[$organizationId]['noOfActivitiesPublished'] = $this->getNoOfActivitiesPublished($organizationId)[0]->noofpublishedactivities;
         $organizationDetails[$organizationId]['organizationDataPublished'] = $this->statusOfOrganizationDataPublished($organizationId)[0]->organizationdatapublished;
         $organizationUpdatedAt = OrganizationData::where('organization_id', $organizationId)->select('updated_at')->first();
         $organizationDetails[$organizationId]['organizationLastUpdatedAt'] = $organizationUpdatedAt ? $organizationUpdatedAt->updated_at : ' ';
     });
     return $organizationDetails;
 }