Hey does anyone have some knowedlge on getting a custom module to talk with the UserRepo? I created a module, added the Repo as it was add on the frontend users listing. But I am getting nothing. When I try to print the array it comes back as php memory exceeded, however I do not believe its a php memory issue. My code for the module controller is:
<?php
namespace Modules\Staff\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Models\Enums\UserState;
use App\Repositories\Criteria\WhereCriteria;
use App\Repositories\UserRepository;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use League\ISO3166\ISO3166;
use Prettus\Repository\Exceptions\RepositoryException;
/**
* Class AdminController
* @package Modules\Staff\Http\Controllers\Admin
*/
class AdminController extends Controller
{
private $userRepo;
/**
* @param UserRepository $userRepo
*/
public function __construct(UserRepository $userRepo)
{
$this->userRepo = $userRepo;
}
public function index(Request $request)
{
$where = [];
if (setting('pilots.hide_inactive')) {
$where['state'] = UserState::ACTIVE;
}
try {
$this->userRepo->pushCriteria(new WhereCriteria($request, $where));
} catch (RepositoryException $e) {
Log::emergency($e);
}
$users = $this->userRepo
->with(['airline', 'current_airport'])
->orderBy('pilot_id', 'asc');
return view('staff::admin.index', [
'users' => $users,
]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('staff::admin.create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
}
/**
* Show the specified resource.
*/
public function show()
{
return view('staff::admin.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit()
{
return view('staff::admin.edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request)
{
}
/**
* Remove the specified resource from storage.
*/
public function destroy()
{
}
}
Any help would be appreciated!