Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Extend OC-Builder for easy Schema creation #10

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,38 @@

class Plugin extends PluginBase
{
/**
* @var array Plugin dependencies
*/
public $require = ['RainLab.Builder'];

public function boot()
{
App::register('\TheFehr\Lighthouse\Provider\LighthouseServiceProvider');

App::error(function($e) {
if(preg_match('/direrror/',$e->getMessage())) {
return 'The plugin directory does not exist and could not be created.';
}
if(preg_match('/yamlerror/',$e->getMessage())) {
return 'The YAML content could not be created.';
}
if(preg_match('/fileerror/',$e->getMessage())) {
return 'The YAML file could not be opened.';
}
if(preg_match('/writeerror/',$e->getMessage())) {
return 'The YAML file could not be written.';
}
});
}

public function registerPermissions()
{
return [
'rainlab.builder.manage_schemas' => [
'tab' => 'rainlab.builder::lang.plugin.name',
'label' => 'rainlab.builder::lang.plugin.manage_schemas']
];
}

public function registerSettings()
Expand Down
2 changes: 1 addition & 1 deletion lang/en/lang.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php return [
'plugin' => [
'name' => 'Lighthouse',
'description' => ''
'description' => 'This plugin adds a graphql server endpoint as well as extends the RainLab Builder plugin to auto-generate a GraphQL Schema from database columns.'
],
'models' => [
'schema' => [
Expand Down