@@ -170,8 +170,8 @@ |
||
170 | 170 | { |
171 | 171 | // Could swap this out for model -> getAttribute, then check if we have an attribute or a relation... getRelationValue() is helpful |
172 | 172 | if (method_exists($this->model, $key) && is_a(call_user_func_array([$this->model, $key], []), 'Illuminate\Database\Eloquent\Relations\Relation')) { |
173 | - foreach ($this->{$action.'Relations'} as $relationship => $method) { |
|
174 | - if (is_a(call_user_func_array([$this->model, $key], []), 'Illuminate\Database\Eloquent\Relations\\'.$relationship)) { |
|
173 | + foreach ($this->{$action . 'Relations'} as $relationship => $method) { |
|
174 | + if (is_a(call_user_func_array([$this->model, $key], []), 'Illuminate\Database\Eloquent\Relations\\' . $relationship)) { |
|
175 | 175 | $this->model->$key()->$method($value); |
176 | 176 | |
177 | 177 | return; |
@@ -8,7 +8,6 @@ |
||
8 | 8 | * Create a new Attribute Instance |
9 | 9 | * |
10 | 10 | * @param string $type |
11 | - * @param string $action |
|
12 | 11 | * @param string $attribute |
13 | 12 | * @param string $field |
14 | 13 | * @param string $model |
@@ -40,7 +40,7 @@ |
||
40 | 40 | throw new \Exception('Attribute Field Type cannot be empty or undefined.'); |
41 | 41 | } |
42 | 42 | |
43 | - return call_user_func_array([$this->createAttribute($field['type'], $action, $attribute, $field, $modelManager), camel_case('render_'.$action)], []); |
|
43 | + return call_user_func_array([$this->createAttribute($field['type'], $action, $attribute, $field, $modelManager), camel_case('render_' . $action)], []); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function render($view = false) |
76 | 76 | { |
77 | - if (method_exists($this, $method = 'render'.ucfirst($view))) { |
|
77 | + if (method_exists($this, $method = 'render' . ucfirst($view))) { |
|
78 | 78 | return new HtmlString( |
79 | 79 | call_user_func_array([$this, $method], []) |
80 | 80 | ); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function renderAdd() |
90 | 90 | { |
91 | - return view($this->viewpath.'.add', $this->viewData()); |
|
91 | + return view($this->viewpath . '.add', $this->viewData()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function renderEdit() |
100 | 100 | { |
101 | - return view($this->viewpath.'.edit', $this->viewData()); |
|
101 | + return view($this->viewpath . '.edit', $this->viewData()); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function renderClone() |
110 | 110 | { |
111 | - if (view()->exists($this->viewpath.'.clone')) { |
|
112 | - view($this->viewpath.'.clone', $this->viewData()); |
|
111 | + if (view()->exists($this->viewpath . '.clone')) { |
|
112 | + view($this->viewpath . '.clone', $this->viewData()); |
|
113 | 113 | } |
114 | 114 | |
115 | - return view($this->viewpath.'.edit', $this->viewData()); |
|
115 | + return view($this->viewpath . '.edit', $this->viewData()); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function renderView() |
124 | 124 | { |
125 | - return view($this->viewpath.'.view', $this->viewData()); |
|
125 | + return view($this->viewpath . '.view', $this->viewData()); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function getFieldOptions() |
154 | 154 | { |
155 | - if (method_exists($this->getModelManager(), $method = camel_case('get_'.$this->getAttribute().'_options'))) { |
|
155 | + if (method_exists($this->getModelManager(), $method = camel_case('get_' . $this->getAttribute() . '_options'))) { |
|
156 | 156 | // First check for a method of options based on getAttributeNameOptions() |
157 | 157 | $this->field['options'] = $this->getModelManager()->$method(); |
158 | - } elseif (isset($this->field['options']) && is_string($this->field['options']) && method_exists($this->getModelManager(), $method = camel_case('get_'.$this->field['options'].'_options'))) { |
|
158 | + } elseif (isset($this->field['options']) && is_string($this->field['options']) && method_exists($this->getModelManager(), $method = camel_case('get_' . $this->field['options'] . '_options'))) { |
|
159 | 159 | // Check if Options is a string and if so, check for a method |
160 | 160 | // of options based on getDefinedOptions() |
161 | 161 | $this->field['options'] = $this->getModelManager()->$method(); |
@@ -32,6 +32,7 @@ discard block |
||
32 | 32 | * Create a new collection. |
33 | 33 | * |
34 | 34 | * @param mixed $items |
35 | + * @param \LaravelFlare\Flare\Admin\Models\ModelAdmin $modelManager |
|
35 | 36 | * |
36 | 37 | * @return void |
37 | 38 | */ |
@@ -48,7 +49,7 @@ discard block |
||
48 | 49 | * Attempt to reformat the current attribute items array |
49 | 50 | * into the most usable format (an Attribute Collection). |
50 | 51 | * |
51 | - * @return void |
|
52 | + * @return AttributeCollection |
|
52 | 53 | */ |
53 | 54 | public function formatFields() |
54 | 55 | { |