{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Helpers","type":"basic","slug":"helpers","excerpt":"","body":"Orchestra Platform includes a set of helpers function to help solves some of the frequent problem while developing on Laravel.\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"orchestra()\"\n}\n[/block]\nReturn `orchestra.app` instance.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\necho orchestra()->memory()->get('site.name');\\n\\n# You can also use the following to get the same value\\n\\necho orchestra('memory')->get('site.name');\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"handles()\"\n}\n[/block]\nReturn handles configuration for a package to generate a full URL.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\necho handles('orchestra/foundation::users');\\n\\n# You can also use `orchestra` as an alias to `orchestra/foundation`.\\n\\necho handles('orchestra::users');\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\nAbove code would return `/admin/users`, however if your Orchestra Platform configuration is set to use root path as the handles, the same code would then return `/users`.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"During boot process, Orchestra Platform will automatically set handle for each packages, if specified in `orchestra.json` to `orchestra/extension::handles.vendor/package`, this can be modified from the extension configuration page.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"memorize()\"\n}\n[/block]\nReturn memory configuration associated to the request.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\necho memorize('site.name');\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"messages()\"\n}\n[/block]\nAdd a new flash messages for the following request.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\nmessages('success', 'User has been created.');\\n\\nmessages('error', 'Unable to update the database!');\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"get_meta()\"\n}\n[/block]\nGet available meta data for current request:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\nget_meta('title');\\n\\n# You can also set a default value if key is not available\\n\\nget_meta('title', 'Home');\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"set_meta()\"\n}\n[/block]\nSet new meta data for current request:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\nset_meta('title', 'Welcome');\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]","updates":[],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"576ed19af37ab417001474be","version":{"version":"3.3","version_clean":"3.3.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["576ebdb79c84a31900958abe","576ebfc59c84a31900958ac4","576ec32f52f96619007cfb9a","576ec7b7560eef0e00cd3096","576ed4249c84a31900958add","576ed429560eef0e00cd30a3","576ed43a52f96619007cfbb5","576ed44d5a8c72170082b794","577212f20da40019004f0816","57725c7e0a6d610e00de9e4c"],"_id":"576ebdb79c84a31900958abd","project":"576ebdb79c84a31900958aba","releaseDate":"2016-06-25T17:21:59.854Z","__v":10,"createdAt":"2016-06-25T17:21:59.854Z"},"project":"576ebdb79c84a31900958aba","__v":11,"user":"576ebd239c84a31900958ab9","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Basics","slug":"deployment","order":3,"from_sync":false,"reference":false,"_id":"576ec7b7560eef0e00cd3096","version":"576ebdb79c84a31900958abd","__v":0,"project":"576ebdb79c84a31900958aba","createdAt":"2016-06-25T18:04:39.266Z"},"createdAt":"2016-06-25T18:46:50.735Z","githubsync":"","parentDoc":null}
Orchestra Platform includes a set of helpers function to help solves some of the frequent problem while developing on Laravel. [block:api-header] { "type": "fn", "title": "orchestra()" } [/block] Return `orchestra.app` instance. [block:code] { "codes": [ { "code": "<?php\n\necho orchestra()->memory()->get('site.name');\n\n# You can also use the following to get the same value\n\necho orchestra('memory')->get('site.name');", "language": "php" } ] } [/block] [block:api-header] { "type": "fn", "title": "handles()" } [/block] Return handles configuration for a package to generate a full URL. [block:code] { "codes": [ { "code": "<?php\n\necho handles('orchestra/foundation::users');\n\n# You can also use `orchestra` as an alias to `orchestra/foundation`.\n\necho handles('orchestra::users');", "language": "php" } ] } [/block] Above code would return `/admin/users`, however if your Orchestra Platform configuration is set to use root path as the handles, the same code would then return `/users`. [block:callout] { "type": "info", "body": "During boot process, Orchestra Platform will automatically set handle for each packages, if specified in `orchestra.json` to `orchestra/extension::handles.vendor/package`, this can be modified from the extension configuration page." } [/block] [block:api-header] { "type": "fn", "title": "memorize()" } [/block] Return memory configuration associated to the request. [block:code] { "codes": [ { "code": "<?php\n\necho memorize('site.name');", "language": "php" } ] } [/block] [block:api-header] { "type": "fn", "title": "messages()" } [/block] Add a new flash messages for the following request. [block:code] { "codes": [ { "code": "<?php\n\nmessages('success', 'User has been created.');\n\nmessages('error', 'Unable to update the database!');", "language": "php" } ] } [/block] [block:api-header] { "type": "fn", "title": "get_meta()" } [/block] Get available meta data for current request: [block:code] { "codes": [ { "code": "<?php\n\nget_meta('title');\n\n# You can also set a default value if key is not available\n\nget_meta('title', 'Home');", "language": "php" } ] } [/block] [block:api-header] { "type": "fn", "title": "set_meta()" } [/block] Set new meta data for current request: [block:code] { "codes": [ { "code": "<?php\n\nset_meta('title', 'Welcome');", "language": "php" } ] } [/block]