I think you are doing things wrong. Check this docs: https://cartalyst.com/manual/platform/4.0#extending-extensions https://github.com/cartalyst/platform-users/wiki/Extending-the-user's-extension
How to create a new extension for Cartalyst Platform?
Hi, I installed Cartalyst Platform 4.0 and I am trying to play around with it so I can understand it since the is not a whole lots of lessons out there.
I simply copied the Access Extension located on \extensions\platform\access into and \extensions\crm\access and then I renamed it to "accounts" (i.e.\extensions\crm\accounts)
Then I changed all the name spaces to the new path.
But every time I open my app I get this error Class 'crm\Accounts\Providers\AccountsServiceProvider' not found
I don't know why am I getting this error I do have AccountsServiceProvider.php file with the AccountsServiceProvider class name located on \extensions\crm\accounts\Providers
I am not sure is it because I created another folder next to the platform? I am just trying to keep my extensions separate from the extensions that comes with the Platform.
What do I need to do to fix this issue?
Here is my AccountsServiucePrivider class
<?php
namespace crm\Accounts\Providers;
use Illuminate\Support\Facades;
use Platform\Access\Redirector;
use Platform\Access\UrlGenerator;
use Cartalyst\Support\ServiceProvider;
class AccountsServiceProvider extends ServiceProvider
{
/**
* {@inheritDoc}
*/
public function boot()
{
// Load the filters
require __DIR__.'/../filters.php';
// Overrides the Sentinel models
$this->overrideSentinelModels();
}
/**
* {@inheritDoc}
*/
public function register()
{
$this->prepareResources();
$this->registerMiddleware();
$this->setAdminUri();
}
/**
* Prepare the package resources.
*
* @return void
*/
protected function prepareResources()
{
$config = realpath(__DIR__.'/../../config/config.php');
$this->mergeConfigFrom($config, 'crm-accounts');
$this->publishes([
$config => config_path('crm-accounts.php'),
], 'config');
}
/**
* Registers the permissions middleware.
*
* @return void
*/
protected function registerMiddleware()
{
$this->app['router']->middleware('permissions', 'Platform\Access\Middleware\Permissions');
}
/**
* Sets the admin uri on the url generator.
*
* @return void
*/
protected function setAdminUri()
{
$this->app['url']->setAdminUri(admin_uri());
}
/**
* Overrides the Sentinel models.
*
* @return void
*/
protected function overrideSentinelModels()
{
// Get the roles and users models
$rolesModel = get_class($this->app['Platform\Roles\Models\Role']);
$usersModel = get_class($this->app['Platform\Users\Models\User']);
// Set our models within Sentinel
$this->app['sentinel.roles']->setModel($rolesModel);
$this->app['sentinel.users']->setModel($usersModel);
$this->app['sentinel.persistence']->setUsersModel($usersModel);
// Override the users model on the roles model
$rolesModel::setUsersModel($usersModel);
// Override the roles model on the users model
$usersModel::setRolesModel($rolesModel);
}
}
Please or to participate in this conversation.