-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ARCANEDEV/update-workspaces
Adding the ability to set multiple workspaces
- Loading branch information
Showing
23 changed files
with
438 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php namespace Arcanedev\Assets\Helpers; | ||
|
||
use Illuminate\Support\Arr; | ||
|
||
/** | ||
* Class Workspaces | ||
* | ||
* @package Arcanedev\Assets\Helpers | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
class Workspaces | ||
{ | ||
/* ----------------------------------------------------------------- | ||
| Main Methods | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Get the default workspace name. | ||
* | ||
* @param string|null $default | ||
* | ||
* @return \Illuminate\Config\Repository|mixed | ||
*/ | ||
public static function getDefaultName($default = null) | ||
{ | ||
return config('assets.default-workspace', $default); | ||
} | ||
|
||
/** | ||
* Get the workspace configs. | ||
* | ||
* @param string $name | ||
* @param array|null $default | ||
* | ||
* @return array|null | ||
*/ | ||
public static function get($name, $default = null) | ||
{ | ||
return Arr::get(static::all(), $name, $default); | ||
} | ||
|
||
/** | ||
* Get all the workspaces. | ||
* | ||
* @return array | ||
*/ | ||
public static function all() | ||
{ | ||
return config('assets.workspaces'); | ||
} | ||
|
||
/** | ||
* Get all workspaces' names. | ||
* | ||
* @return array | ||
*/ | ||
public static function keys() | ||
{ | ||
return array_keys(static::all()); | ||
} | ||
|
||
/** | ||
* Get all the root directories. | ||
* | ||
* @return array|mixed | ||
*/ | ||
public static function getAllRootDirectories() | ||
{ | ||
return array_column(static::all(), 'root-directory'); | ||
} | ||
|
||
/** | ||
* Check if the root directory exists by the given workspace. | ||
* | ||
* @param string $name | ||
* | ||
* @return bool | ||
*/ | ||
public static function rootDirectoryExists($name) | ||
{ | ||
$directory = config("assets.workspaces.{$name}.root-directory"); | ||
|
||
return ! is_null($directory) && is_dir($directory); | ||
} | ||
} |
Oops, something went wrong.