public function index() { // $usuarios = User::with('group')->get(); // return $this->view('users.index')->with(['usuarios' => $usuarios, 'relations_menu' => \BWAdmin::createRelationshipsMenu(User::class)]); }
public function deleteRelationships() { $relationships = \BWAdmin::get('relationships')->get()->where('model', get_class())->where('parent', request('relation_id')); // $relationships->each(function ($relation) { $relation['type']::detach($this, $relation); }); }
public static function make($model, $form, $data, $rules, $messages = [], $customAttributes = [], $parent = null) { $relationships = \BWAdmin::get('relationships')->get()->where('model', $model)->where('parent', $parent)->filter(function ($item) { return !is_null($item['validator']); }); // $relationships->each(function ($relation) use(&$rules) { $rules[$relation['name']] = $relation['validator']; }); // $form = new $form(); $attributes = array_merge($form->getValidatorAttributes(), $customAttributes); // return \Validator::make($data, $rules, $messages, $attributes); }
public function handle() { // $data = []; $id = $this->option('id'); $results = \BWAdmin::get('relationships')->get($id); foreach ($results as $i) { $properties = "ID: {$i['id']}\n"; $properties .= "Type: {$i['type']}\n"; $properties .= "Parent: {$i['parent']}\n"; $data[] = [$i['model'], $i['name'], $properties]; } // $this->table(['Model', 'Name', 'Properties'], $data); }
public function map(Router $router) { $router->group(BwRouter::getParameters('guest'), function (Router $router) { require __DIR__ . '/../../routes/login.php'; }); $router->group(BwRouter::getParameters('default'), function (Router $router) { require __DIR__ . '/../../routes/admin.php'; // relationships $router->group(['prefix' => 'relationships'], function (Router $router) { $relationships = \BWAdmin::get('relationships')->get(); foreach ($relationships as $relations) { if (method_exists($relations['type'], 'getManagerRouterFile')) { require $relations['type']::getManagerRouterFile(); } } }); }); }
public function handle() { // $data = []; $id = $this->option('id'); $results = \BWAdmin::get('relationships')->get($id); foreach ($results as $params) { // unset($params['relationships']); // $properties = ''; foreach ($params as $key => $value) { $properties .= "{$key}: {$value}\n"; } $data[] = [$params['model'], $params['name'], $properties]; } // $this->table(['Model', 'Name', 'All Properties'], $data); }
public function __construct() { // $this->menus = \BWAdmin::get('menu')->get(); // foreach ($this->menus as &$m1) { $m1['href'] = isset($m1['route']) ? route($m1['route']) : '#'; $m1['route-index'] = isset($m1['route-index']) ? route($m1['route-index']) : '#'; if (isset($m1['itens'])) { foreach ($m1['itens'] as &$m2) { $m2['href'] = isset($m2['route']) ? route($m2['route']) : '#'; if (isset($m2['itens'])) { foreach ($m2['itens'] as &$m3) { $m3['href'] = isset($m3['route']) ? route($m3['route']) : '#'; } } } } } }
public function ref() { $relation = \BWAdmin::get('relationships')->get($this->relation_id)->first(); $instance = new $relation['model'](); return new MorphOneToMany($instance->newQuery(), $this, 'listable', 'relation_listings_rel', 'list_id', 'listable_id', 'ref', true); }
private function createBreadcrumb($title = null) { $breadcrumb = []; $relation = $this->getRelation(); while (!is_null($relation['parent'])) { $breadcrumb[] = ['title' => $relation['title'], 'href' => route('bw.relationships.listing.index', ['relation_id' => $relation['id']])]; $relation = \BWAdmin::get('relationships')->get()->where('id', $relation['parent'])->first(); } // $breadcrumb[] = ['title' => $relation['title'], 'href' => route('bw.relationships.listing.index', ['relation_id' => $relation['id']])]; // $model = \BWAdmin::get('relationships')->getModel($relation['model']); $breadcrumb[] = ['title' => $model['title'], 'href' => route($model['route-index'])]; // $breadcrumb = array_reverse($breadcrumb); // if (!is_null($title)) { $breadcrumb[] = ['title' => $title, 'href' => false]; } else { $breadcrumb[count($breadcrumb) - 1]['href'] = false; } // return $breadcrumb; }
public function ref() { $relation = \BWAdmin::get('relationships')->get($this->relation_id)->first(); return $this->belongsTo($relation['model']); }
public function ref() { $relation = \BWAdmin::get('relationships')->get($this->relation_id)->first(); return $this->morphedByMany($relation['model'], 'listable', 'listings_rel', 'list_id'); }
private function getRelation() { return \BWAdmin::get('relationships')->get()->where('id', request('relation_id'))->first(); }
private function getModelFromName($key) { $relationship = \BWAdmin::get('relationships')->get()->where('model', get_class())->where('name', $key)->first(); return $relationship; }