@@ -26,17 +26,17 @@ |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $this->publishes([ |
| 29 | - __DIR__.'/config' => realpath('config'), |
|
| 30 | - __DIR__.'/lang' => \Config::get('repository.lang_path')."/en", |
|
| 31 | - ],'repository-generator'); |
|
| 29 | + __DIR__ . '/config' => realpath('config'), |
|
| 30 | + __DIR__ . '/lang' => \Config::get('repository.lang_path') . "/en", |
|
| 31 | + ], 'repository-generator'); |
|
| 32 | 32 | |
| 33 | 33 | if ($this->app['config']->get('repository') === null) { |
| 34 | - $this->app['config']->set('repository', require __DIR__.'/config/repository.php'); |
|
| 34 | + $this->app['config']->set('repository', require __DIR__ . '/config/repository.php'); |
|
| 35 | 35 | } |
| 36 | - $this->mergeConfigFrom(__DIR__.'/config/repository.php', 'repository-config'); |
|
| 36 | + $this->mergeConfigFrom(__DIR__ . '/config/repository.php', 'repository-config'); |
|
| 37 | 37 | $this->publishes([ |
| 38 | - realpath(__DIR__ . '/../stubs') => \Config::get('repository.resources_path',realpath(__DIR__.'/../../../../resources/')), |
|
| 39 | - ],'repository-stub'); |
|
| 38 | + realpath(__DIR__ . '/../stubs') => \Config::get('repository.resources_path', realpath(__DIR__ . '/../../../../resources/')), |
|
| 39 | + ], 'repository-stub'); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -100,9 +100,9 @@ |
||
| 100 | 100 | } |
| 101 | 101 | }); |
| 102 | 102 | }); |
| 103 | + } else { |
|
| 104 | + $latest->orWhere($columns, 'like', "%" . $criteria['search'] . "%"); |
|
| 103 | 105 | } |
| 104 | - else |
|
| 105 | - $latest->orWhere($columns, 'like', "%" . $criteria['search'] . "%"); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | unset($criteria['search']); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->breadcrumbs = new Collection(); |
| 59 | 59 | |
| 60 | 60 | $language = $request->header('Language', 'en'); |
| 61 | - if (! in_array($language, \Config::get('app.locales', []))) { |
|
| 61 | + if (!in_array($language, \Config::get('app.locales', []))) { |
|
| 62 | 62 | $language = 'en'; |
| 63 | 63 | } |
| 64 | 64 | $limit = $request->get('limit', 10); |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | $this->interface = $interface; |
| 107 | 107 | $this->isAPI = $request->expectsJson(); |
| 108 | 108 | |
| 109 | - if (! $this->isAPI) { |
|
| 109 | + if (!$this->isAPI) { |
|
| 110 | 110 | $this->breadcrumbs = new Collection(); |
| 111 | 111 | $this->search = new Collection(); |
| 112 | - \View::share('pageTitle', $this->pageTitle.' | '.\Config::get('app.name')); |
|
| 112 | + \View::share('pageTitle', $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
| 113 | 113 | \View::share('breadcrumbs', $this->breadcrumbs); |
| 114 | 114 | \View::share('menu', $this->menu); |
| 115 | 115 | \View::share('search', $this->search); |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | public function index() |
| 128 | 128 | { |
| 129 | 129 | $data = $this->interface->simplePaginate($this->limit, $this->request->all()); |
| 130 | - if (! $this->isAPI) { |
|
| 131 | - \View::share('pageTitle', 'List '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
| 130 | + if (!$this->isAPI) { |
|
| 131 | + \View::share('pageTitle', 'List ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
| 132 | 132 | $this->breadcrumbs->put('index', [ |
| 133 | 133 | 'link' => $this->routeIndex, |
| 134 | 134 | 'text' => $this->pageTitle, |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function create() |
| 158 | 158 | { |
| 159 | - if (! $this->isAPI) { |
|
| 160 | - \View::share('pageTitle', 'Create '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
| 159 | + if (!$this->isAPI) { |
|
| 160 | + \View::share('pageTitle', 'Create ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
| 161 | 161 | $this->breadcrumbs->put('create', [ |
| 162 | 162 | 'link' => $this->createRoute, |
| 163 | 163 | 'text' => trans('repository-generator.create'), |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | public function store() |
| 178 | 178 | { |
| 179 | 179 | $entity = $this->interface->create($this->request->except(['_token', '_method'])); |
| 180 | - return $this->makeResponse($entity,true); |
|
| 180 | + return $this->makeResponse($entity, true); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -190,11 +190,11 @@ discard block |
||
| 190 | 190 | public function show($entityId) |
| 191 | 191 | { |
| 192 | 192 | $entity = $this->interface->find($entityId); |
| 193 | - if (! $this->isAPI) { |
|
| 194 | - if (! $entity) { |
|
| 193 | + if (!$this->isAPI) { |
|
| 194 | + if (!$entity) { |
|
| 195 | 195 | return \Redirect::to($this->routeIndex)->with('warning', __('repository-generator.not_found')); |
| 196 | 196 | } |
| 197 | - \View::share('pageTitle', 'View '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
| 197 | + \View::share('pageTitle', 'View ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
| 198 | 198 | $this->breadcrumbs->put('view', [ |
| 199 | 199 | 'link' => '', |
| 200 | 200 | 'text' => __('repository-generator.show'), |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | return view($this->viewShow, $this->params) |
| 204 | 204 | ->with('entity', $entity); |
| 205 | 205 | } |
| 206 | - if (! $entity) { |
|
| 206 | + if (!$entity) { |
|
| 207 | 207 | return response()->json(null, JsonResponse::HTTP_NOT_FOUND); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | public function edit($entityId) |
| 224 | 224 | { |
| 225 | 225 | $entity = $this->interface->find($entityId); |
| 226 | - if (! $this->isAPI) { |
|
| 227 | - if (! $entity) { |
|
| 226 | + if (!$this->isAPI) { |
|
| 227 | + if (!$entity) { |
|
| 228 | 228 | return \Redirect::to($this->routeIndex)->with('warning', __('repository-generator.not_found')); |
| 229 | 229 | } |
| 230 | 230 | $this->breadcrumbs->put('edit', [ |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | { |
| 251 | 251 | $entity = $this->interface->update($entityId, $this->request->except(['_token', '_method'])); |
| 252 | 252 | |
| 253 | - return $this->makeResponse($entity,true); |
|
| 253 | + return $this->makeResponse($entity, true); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -304,9 +304,9 @@ discard block |
||
| 304 | 304 | * |
| 305 | 305 | * @return \Illuminate\Http\RedirectResponse |
| 306 | 306 | */ |
| 307 | - function makeResponse($entity,$appendEntity = false) |
|
| 307 | + function makeResponse($entity, $appendEntity = false) |
|
| 308 | 308 | { |
| 309 | - if (! $this->isAPI) { |
|
| 309 | + if (!$this->isAPI) { |
|
| 310 | 310 | if ($entity) { |
| 311 | 311 | return \Redirect::to($this->routeIndex)->with('message', __('repository-generator.success')); |
| 312 | 312 | } |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | if ($entity) { |
| 322 | - if($appendEntity) |
|
| 323 | - return response()->json( ['status' => true, 'message' => __('repository-generator.success'), 'data' => $entity], |
|
| 322 | + if ($appendEntity) |
|
| 323 | + return response()->json(['status' => true, 'message' => __('repository-generator.success'), 'data' => $entity], |
|
| 324 | 324 | JsonResponse::HTTP_OK); |
| 325 | 325 | return response()->json(null, JsonResponse::HTTP_NO_CONTENT); |
| 326 | 326 | } |
@@ -319,9 +319,10 @@ |
||
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | if ($entity) { |
| 322 | - if($appendEntity) |
|
| 323 | - return response()->json( ['status' => true, 'message' => __('repository-generator.success'), 'data' => $entity], |
|
| 322 | + if($appendEntity) { |
|
| 323 | + return response()->json( ['status' => true, 'message' => __('repository-generator.success'), 'data' => $entity], |
|
| 324 | 324 | JsonResponse::HTTP_OK); |
| 325 | + } |
|
| 325 | 326 | return response()->json(null, JsonResponse::HTTP_NO_CONTENT); |
| 326 | 327 | } |
| 327 | 328 | |
@@ -6,11 +6,11 @@ |
||
| 6 | 6 | * Time: 09:58 am |
| 7 | 7 | */ |
| 8 | 8 | return [ |
| 9 | - 'app_path' => realpath(__DIR__.'/../app/'), |
|
| 9 | + 'app_path' => realpath(__DIR__ . '/../app/'), |
|
| 10 | 10 | 'route_path' => realpath('routes/'), |
| 11 | - 'resources_path' => realpath(__DIR__.'/../vendor/shamaseen/repository-generator/stubs'), |
|
| 12 | - 'stubs_path' => realpath('resources')."/stubs", |
|
| 13 | - 'lang_path' => realpath('resources')."/lang", |
|
| 11 | + 'resources_path' => realpath(__DIR__ . '/../vendor/shamaseen/repository-generator/stubs'), |
|
| 12 | + 'stubs_path' => realpath('resources') . "/stubs", |
|
| 13 | + 'lang_path' => realpath('resources') . "/lang", |
|
| 14 | 14 | 'config_path' => realpath('config'), |
| 15 | 15 | |
| 16 | 16 | //relative to app path |