1. Go to this page and download the library: Download democracyapps/member-org library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use DemocracyApps\MemberOrg\EloquentMemberOrganization;
use DemocracyApps\MemberOrg\Organization;
class Company implements MemberOrganization
{
use EloquentMemberOrganization;
...
}
use DemocracyApps\MemberOrg\EloquentOrganizationMember;
use DemocracyApps\MemberOrg\OrganizationMember;
class CompanyMember implements OrganizationMember
{
use EloquentOrganizationMember;
...
}
class VerifyCompanyAccess {
/**
* Check that user is logged in and allowed access to this page
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (\Auth::guest()) return redirect()->guest('/auth/login');
$id = $request->segment(2);
$company = Company::find($id);
if ($company == null) {
return redirect('/');
}
if (! $company->userHasAccess(\Auth::user(), 9)) {
return redirect('/');
}
return $next($request);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.