PageRenderTime 43ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/workbench/tommunz/team/extension.php

https://gitlab.com/eminiarts/tommunz
PHP | 311 lines | 88 code | 49 blank | 174 comment | 0 complexity | 06fe4d4803a9cdc40d2e3e6ea74747e3 MD5 | raw file
  1. <?php
  2. use Illuminate\Foundation\Application;
  3. use Cartalyst\Extensions\ExtensionInterface;
  4. use Cartalyst\Settings\Repository as Settings;
  5. use Cartalyst\Permissions\Container as Permissions;
  6. return [
  7. /*
  8. |--------------------------------------------------------------------------
  9. | Name
  10. |--------------------------------------------------------------------------
  11. |
  12. | This is your extension name and it is only required for
  13. | presentational purposes.
  14. |
  15. */
  16. 'name' => 'Team',
  17. /*
  18. |--------------------------------------------------------------------------
  19. | Slug
  20. |--------------------------------------------------------------------------
  21. |
  22. | This is your extension unique identifier and should not be changed as
  23. | it will be recognized as a new extension.
  24. |
  25. | Ideally, this should match the folder structure within the extensions
  26. | folder, but this is completely optional.
  27. |
  28. */
  29. 'slug' => 'tommunz/team',
  30. /*
  31. |--------------------------------------------------------------------------
  32. | Author
  33. |--------------------------------------------------------------------------
  34. |
  35. | Because everybody deserves credit for their work, right?
  36. |
  37. */
  38. 'author' => 'Emini Arts',
  39. /*
  40. |--------------------------------------------------------------------------
  41. | Description
  42. |--------------------------------------------------------------------------
  43. |
  44. | One or two sentences describing the extension for users to view when
  45. | they are installing the extension.
  46. |
  47. */
  48. 'description' => 'Tommunz Team Extension',
  49. /*
  50. |--------------------------------------------------------------------------
  51. | Version
  52. |--------------------------------------------------------------------------
  53. |
  54. | Version should be a string that can be used with version_compare().
  55. | This is how the extensions versions are compared.
  56. |
  57. */
  58. 'version' => '0.1.0',
  59. /*
  60. |--------------------------------------------------------------------------
  61. | Requirements
  62. |--------------------------------------------------------------------------
  63. |
  64. | List here all the extensions that this extension requires to work.
  65. | This is used in conjunction with composer, so you should put the
  66. | same extension dependencies on your main composer.json require
  67. | key, so that they get resolved using composer, however you
  68. | can use without composer, at which point you'll have to
  69. | ensure that the required extensions are available.
  70. |
  71. */
  72. 'require' => [],
  73. /*
  74. |--------------------------------------------------------------------------
  75. | Autoload Logic
  76. |--------------------------------------------------------------------------
  77. |
  78. | You can define here your extension autoloading logic, it may either
  79. | be 'composer', 'platform' or a 'Closure'.
  80. |
  81. | If composer is defined, your composer.json file specifies the autoloading
  82. | logic.
  83. |
  84. | If platform is defined, your extension receives convetion autoloading
  85. | based on the Platform standards.
  86. |
  87. | If a Closure is defined, it should take two parameters as defined
  88. | bellow:
  89. |
  90. | object \Composer\Autoload\ClassLoader $loader
  91. | object \Illuminate\Foundation\Application $app
  92. |
  93. | Supported: "composer", "platform", "Closure"
  94. |
  95. */
  96. 'autoload' => 'composer',
  97. /*
  98. |--------------------------------------------------------------------------
  99. | Service Providers
  100. |--------------------------------------------------------------------------
  101. |
  102. | Define your extension service providers here. They will be dynamically
  103. | registered without having to include them in app/config/app.php.
  104. |
  105. */
  106. 'providers' => [
  107. 'Tommunz\Team\Providers\EmployeeServiceProvider',
  108. ],
  109. /*
  110. |--------------------------------------------------------------------------
  111. | Routes
  112. |--------------------------------------------------------------------------
  113. |
  114. | Closure that is called when the extension is started. You can register
  115. | any custom routing logic here.
  116. |
  117. | The closure parameters are:
  118. |
  119. | object \Cartalyst\Extensions\ExtensionInterface $extension
  120. | object \Illuminate\Foundation\Application $app
  121. |
  122. */
  123. 'routes' => function (ExtensionInterface $extension, Application $app) {
  124. Route::group([
  125. 'prefix' => admin_uri() . '/team/employees',
  126. 'namespace' => 'Tommunz\Team\Controllers\Admin',
  127. ], function () {
  128. Route::get('/', ['as' => 'admin.tommunz.team.employees.all', 'uses' => 'EmployeesController@index']);
  129. Route::post('/', ['as' => 'admin.tommunz.team.employees.all', 'uses' => 'EmployeesController@executeAction']);
  130. Route::get('grid', ['as' => 'admin.tommunz.team.employees.grid', 'uses' => 'EmployeesController@grid']);
  131. Route::get('create', ['as' => 'admin.tommunz.team.employees.create', 'uses' => 'EmployeesController@create']);
  132. Route::post('create', ['as' => 'admin.tommunz.team.employees.create', 'uses' => 'EmployeesController@store']);
  133. Route::get('{id}', ['as' => 'admin.tommunz.team.employees.edit', 'uses' => 'EmployeesController@edit']);
  134. Route::post('{id}', ['as' => 'admin.tommunz.team.employees.edit', 'uses' => 'EmployeesController@update']);
  135. Route::delete('{id}', ['as' => 'admin.tommunz.team.employees.delete', 'uses' => 'EmployeesController@delete']);
  136. });
  137. Route::group([
  138. 'prefix' => 'team/employees',
  139. 'namespace' => 'Tommunz\Team\Controllers\Frontend',
  140. ], function () {
  141. Route::get('/', ['as' => 'tommunz.team.employees.index', 'uses' => 'EmployeesController@index']);
  142. Route::post('sort', ['as' => 'tommunz.team.employees.map', 'uses' => 'EmployeesController@sort']);
  143. });
  144. },
  145. /*
  146. |--------------------------------------------------------------------------
  147. | Database Seeds
  148. |--------------------------------------------------------------------------
  149. |
  150. | Platform provides a very simple way to seed your database with test
  151. | data using seed classes. All seed classes should be stored on the
  152. | `database/seeds` directory within your extension folder.
  153. |
  154. | The order you register your seed classes on the array below
  155. | matters, as they will be ran in the exact same order.
  156. |
  157. | The seeds array should follow the following structure:
  158. |
  159. | Vendor\Namespace\Database\Seeds\FooSeeder
  160. | Vendor\Namespace\Database\Seeds\BarSeeder
  161. |
  162. */
  163. 'seeds' => [
  164. ],
  165. /*
  166. |--------------------------------------------------------------------------
  167. | Permissions
  168. |--------------------------------------------------------------------------
  169. |
  170. | Register here all the permissions that this extension has. These will
  171. | be shown in the user management area to build a graphical interface
  172. | where permissions can be selected to allow or deny user access.
  173. |
  174. | For detailed instructions on how to register the permissions, please
  175. | refer to the following url https://cartalyst.com/manual/permissions
  176. |
  177. */
  178. 'permissions' => function (Permissions $permissions) {
  179. $permissions->group('employee', function ($g) {
  180. $g->name = 'Employees';
  181. $g->permission('employee.index', function ($p) {
  182. $p->label = trans('tommunz/team::employees/permissions.index');
  183. $p->controller('Tommunz\Team\Controllers\Admin\EmployeesController', 'index, grid');
  184. });
  185. $g->permission('employee.create', function ($p) {
  186. $p->label = trans('tommunz/team::employees/permissions.create');
  187. $p->controller('Tommunz\Team\Controllers\Admin\EmployeesController', 'create, store');
  188. });
  189. $g->permission('employee.edit', function ($p) {
  190. $p->label = trans('tommunz/team::employees/permissions.edit');
  191. $p->controller('Tommunz\Team\Controllers\Admin\EmployeesController', 'edit, update');
  192. });
  193. $g->permission('employee.delete', function ($p) {
  194. $p->label = trans('tommunz/team::employees/permissions.delete');
  195. $p->controller('Tommunz\Team\Controllers\Admin\EmployeesController', 'delete');
  196. });
  197. });
  198. },
  199. /*
  200. |--------------------------------------------------------------------------
  201. | Widgets
  202. |--------------------------------------------------------------------------
  203. |
  204. | Closure that is called when the extension is started. You can register
  205. | all your custom widgets here. Of course, Platform will guess the
  206. | widget class for you, this is just for custom widgets or if you
  207. | do not wish to make a new class for a very small widget.
  208. |
  209. */
  210. 'widgets' => function () {
  211. },
  212. /*
  213. |--------------------------------------------------------------------------
  214. | Settings
  215. |--------------------------------------------------------------------------
  216. |
  217. | Register any settings for your extension. You can also configure
  218. | the namespace and group that a setting belongs to.
  219. |
  220. */
  221. 'settings' => function (Settings $settings, Application $app) {
  222. },
  223. /*
  224. |--------------------------------------------------------------------------
  225. | Menus
  226. |--------------------------------------------------------------------------
  227. |
  228. | You may specify the default various menu hierarchy for your extension.
  229. | You can provide a recursive array of menu children and their children.
  230. | These will be created upon installation, synchronized upon upgrading
  231. | and removed upon uninstallation.
  232. |
  233. | Menu children are automatically put at the end of the menu for extensions
  234. | installed through the Operations extension.
  235. |
  236. | The default order (for extensions installed initially) can be
  237. | found by editing app/config/platform.php.
  238. |
  239. */
  240. 'menus' => [
  241. 'admin' => [
  242. [
  243. 'slug' => 'admin-tommunz-team',
  244. 'name' => 'Team',
  245. 'class' => 'fa fa-circle-o',
  246. 'uri' => 'team',
  247. 'regex' => '/:admin\/team/i',
  248. 'children' => [
  249. [
  250. 'class' => 'fa fa-circle-o',
  251. 'name' => 'Employees',
  252. 'uri' => 'team/employees',
  253. 'regex' => '/:admin\/team\/employee/i',
  254. 'slug' => 'admin-tommunz-team-employee',
  255. ],
  256. ],
  257. ],
  258. ],
  259. 'main' => [
  260. ],
  261. ],
  262. ];