Skip to content
This repository was archived by the owner on Aug 30, 2020. It is now read-only.

Commit eda671a

Browse files
committed
fix view path in packages development
1 parent da6cb38 commit eda671a

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/Components/BaseComponent.php

+17-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Elnooronline\LaravelBootstrapForms\Components;
44

5+
use Illuminate\Support\Str;
56
use Illuminate\Support\Facades\Lang;
67
use Illuminate\Support\Facades\Config;
78
use Illuminate\Contracts\Support\Htmlable;
@@ -112,8 +113,8 @@ public function __construct($resource)
112113
/**
113114
* Initialized the input arguments.
114115
*
115-
* @param null $name
116-
* @param null $value
116+
* @param null $name
117+
* @param null $value
117118
* @return $this
118119
*/
119120
abstract public function init();
@@ -177,7 +178,7 @@ public function name($name)
177178
/**
178179
* The key to be used for the view error bag.
179180
*
180-
* @param string $bag
181+
* @param string $bag
181182
* @return $this
182183
*/
183184
public function errorBag($bag = 'default')
@@ -246,8 +247,8 @@ public function autofocus($autofocus = true)
246247
/**
247248
* Add custom attribute.
248249
*
249-
* @param string|array $key
250-
* @param null $value
250+
* @param string|array $key
251+
* @param null $value
251252
* @return $this
252253
*/
253254
public function attribute($key, $value = null)
@@ -274,6 +275,15 @@ public function note($note)
274275

275276
protected function getViewPath()
276277
{
278+
if (Str::contains($this->viewPath, '::')) {
279+
$alias = explode('::', $this->viewPath)[0];
280+
$path = explode('::', $this->viewPath)[1];
281+
282+
$bootstrap = explode('::', Config::get('laravel-bootstrap-forms.views'));
283+
284+
return $alias.'::'.$bootstrap[1].'.'.$path.'.'.$this->style;
285+
}
286+
277287
return Config::get('laravel-bootstrap-forms.views').'.'.$this->viewPath.'.'.$this->style;
278288
}
279289

@@ -293,7 +303,7 @@ public function style($style)
293303
/**
294304
* Set the input inline validation errors option.
295305
*
296-
* @param bool $bool
306+
* @param bool $bool
297307
* @return $this
298308
*/
299309
public function inlineValidation($bool = true)
@@ -339,7 +349,7 @@ protected function viewComposer()
339349
/**
340350
* Transform the properties to be used in view.
341351
*
342-
* @param array $properties
352+
* @param array $properties
343353
* @return array
344354
*/
345355
protected function transformProperties(array $properties)

0 commit comments

Comments
 (0)