PHP Class Nwidart\Modules\Repository

Inheritance: implements Nwidart\Modules\Contracts\RepositoryInterface, implements Countabl\Countable
显示文件 Open project: nwidart/laravel-modules Class Usage Examples

Protected Properties

Property Type Description
$app Illuminate\Foundation\Application Application instance.
$path string | null The module path.
$paths array The scanned paths.
$stubPath string

Public Methods

Method Description
__construct ( Illuminate\Foundation\Application $app, string | null $path = null ) The constructor.
active ( string $name ) : boolean Determine whether the given module is activated.
addLocation ( string $path ) Add other module location.
addPath ( string $path ) Alternative method for "addPath".
all ( ) : array Get all modules.
asset ( string $asset ) : string Get asset url from a specific module.
assetPath ( $module ) : string Get asset path for a specific module.
boot ( ) Boot the modules.
collections ( ) : Collection Get all modules as laravel collection instance.
config ( $key, null $default = null ) : mixed Get a specific config data from a configuration file.
count ( ) : integer Get count from all modules.
delete ( string $name ) : boolean Delete a specific module.
disable ( string $name ) : boolean Disabling a specific module.
disabled ( ) : array Get list of disabled modules.
enable ( string $name ) : boolean Enabling a specific module.
enabled ( ) : array Get list of enabled modules.
find ( $name ) : mixed | void Find a specific module.
findOrFail ( $name ) : Module Find a specific module, if there return that, otherwise throw exception.
get ( $name ) : mixed | void Alternative for "find" method.
getAssetsPath ( ) : string Get module assets path.
getByStatus ( $status ) : array Get modules by status.
getCached ( ) : array Get cached modules.
getFiles ( ) : Illuminate\Filesystem\Filesystem Get laravel filesystem instance.
getModulePath ( $module ) : string Get module path for a specific module.
getOrdered ( string $direction = 'asc' ) : array Get all ordered modules.
getPath ( ) : string Get a module path.
getPaths ( ) : array Get all additional paths.
getScanPaths ( ) : array Get scanned modules paths.
getStubPath ( ) : string Get stub path.
getUsed ( ) : string Get used now.
getUsedNow ( ) : string Get module used for cli session.
getUsedStoragePath ( ) : string Get storage path for module used.
has ( $name ) : boolean Determine whether the given module exist.
install ( string $name, string $version = 'dev-master', string $type = 'composer', boolean $subtree = false ) : Process Install the specified module.
notActive ( string $name ) : boolean Determine whether the given module is not activated.
register ( ) Register the modules.
scan ( ) : array Get & scan all modules.
setStubPath ( string $stubPath ) Set stub path.
setUsed ( $name ) Set module used for cli session.
toCollection ( ) : Collection Get all modules as collection instance.
update ( string $module ) Update dependencies for the specified module.

Protected Methods

Method Description
formatCached ( array $cached ) : array Format the cached data as array of modules.

Method Details

__construct() public method

The constructor.
public __construct ( Illuminate\Foundation\Application $app, string | null $path = null )
$app Illuminate\Foundation\Application
$path string | null

active() public method

Determine whether the given module is activated.
public active ( string $name ) : boolean
$name string
return boolean

addLocation() public method

Add other module location.
public addLocation ( string $path )
$path string

addPath() public method

Alternative method for "addPath".
public addPath ( string $path )
$path string

all() public method

Get all modules.
public all ( ) : array
return array

asset() public method

Get asset url from a specific module.
public asset ( string $asset ) : string
$asset string
return string

assetPath() public method

Get asset path for a specific module.
public assetPath ( $module ) : string
$module
return string

boot() public method

Boot the modules.
public boot ( )

collections() public method

Get all modules as laravel collection instance.
public collections ( ) : Collection
return Collection

config() public method

Get a specific config data from a configuration file.
public config ( $key, null $default = null ) : mixed
$key
$default null
return mixed

count() public method

Get count from all modules.
public count ( ) : integer
return integer

delete() public method

Delete a specific module.
public delete ( string $name ) : boolean
$name string
return boolean

disable() public method

Disabling a specific module.
public disable ( string $name ) : boolean
$name string
return boolean

disabled() public method

Get list of disabled modules.
public disabled ( ) : array
return array

enable() public method

Enabling a specific module.
public enable ( string $name ) : boolean
$name string
return boolean

enabled() public method

Get list of enabled modules.
public enabled ( ) : array
return array

find() public method

Find a specific module.
public find ( $name ) : mixed | void
$name
return mixed | void

findOrFail() public method

Find a specific module, if there return that, otherwise throw exception.
public findOrFail ( $name ) : Module
$name
return Module

formatCached() protected method

Format the cached data as array of modules.
protected formatCached ( array $cached ) : array
$cached array
return array

get() public method

Alternative for "find" method.
public get ( $name ) : mixed | void
$name
return mixed | void

getAssetsPath() public method

Get module assets path.
public getAssetsPath ( ) : string
return string

getByStatus() public method

Get modules by status.
public getByStatus ( $status ) : array
$status
return array

getCached() public method

Get cached modules.
public getCached ( ) : array
return array

getFiles() public method

Get laravel filesystem instance.
public getFiles ( ) : Illuminate\Filesystem\Filesystem
return Illuminate\Filesystem\Filesystem

getModulePath() public method

Get module path for a specific module.
public getModulePath ( $module ) : string
$module
return string

getOrdered() public method

Get all ordered modules.
public getOrdered ( string $direction = 'asc' ) : array
$direction string
return array

getPath() public method

Get a module path.
public getPath ( ) : string
return string

getPaths() public method

Get all additional paths.
public getPaths ( ) : array
return array

getScanPaths() public method

Get scanned modules paths.
public getScanPaths ( ) : array
return array

getStubPath() public method

Get stub path.
public getStubPath ( ) : string
return string

getUsed() public method

Get used now.
public getUsed ( ) : string
return string

getUsedNow() public method

Get module used for cli session.
public getUsedNow ( ) : string
return string

getUsedStoragePath() public method

Get storage path for module used.
public getUsedStoragePath ( ) : string
return string

has() public method

Determine whether the given module exist.
public has ( $name ) : boolean
$name
return boolean

install() public method

Install the specified module.
public install ( string $name, string $version = 'dev-master', string $type = 'composer', boolean $subtree = false ) : Process
$name string
$version string
$type string
$subtree boolean
return Symfony\Component\Process\Process

notActive() public method

Determine whether the given module is not activated.
public notActive ( string $name ) : boolean
$name string
return boolean

register() public method

Register the modules.
public register ( )

scan() public method

Get & scan all modules.
public scan ( ) : array
return array

setStubPath() public method

Set stub path.
public setStubPath ( string $stubPath )
$stubPath string

setUsed() public method

Set module used for cli session.
public setUsed ( $name )
$name

toCollection() public method

Get all modules as collection instance.
public toCollection ( ) : Collection
return Collection

update() public method

Update dependencies for the specified module.
public update ( string $module )
$module string

Property Details

$app protected_oe property

Application instance.
protected Application,Illuminate\Foundation $app
return Illuminate\Foundation\Application

$path protected_oe property

The module path.
protected string|null $path
return string | null

$paths protected_oe property

The scanned paths.
protected array $paths
return array

$stubPath protected_oe property

protected string $stubPath
return string