@@ -33,6 +33,9 @@ discard block |
||
| 33 | 33 | return $this->storage[$object->name()] = $object; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | + /** |
|
| 37 | + * @param string $name |
|
| 38 | + */ |
|
| 36 | 39 | public function get($name) |
| 37 | 40 | { |
| 38 | 41 | return $this->storage[$name]; |
@@ -94,6 +97,9 @@ discard block |
||
| 94 | 97 | return !$validator->fails(); |
| 95 | 98 | } |
| 96 | 99 | |
| 100 | + /** |
|
| 101 | + * @param \Tacone\DataSource\AbstractDataSource $source |
|
| 102 | + */ |
|
| 97 | 103 | public function from($source) |
| 98 | 104 | { |
| 99 | 105 | foreach ($this as $name => $field) { |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Tacone\Bees\Demo\Models\Article; |
| 6 | 6 | use Tacone\Bees\Widget\Endpoint; |
| 7 | -use View; |
|
| 8 | 7 | |
| 9 | 8 | class EndpointController extends DemoController |
| 10 | 9 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | // add field |
| 71 | 71 | $e->string('name', 'user_name', $sortable) |
| 72 | - ->rules('required|min:4', function ($field) { |
|
| 72 | + ->rules('required|min:4', function($field) { |
|
| 73 | 73 | return 'custom error string for field '.$field->name(); |
| 74 | 74 | }) |
| 75 | 75 | ->options(['enum', 'of', 'choices']); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $field->value(); |
| 92 | 92 | $field->value($newValue); |
| 93 | -$field->onValue(function () { |
|
| 93 | +$field->onValue(function() { |
|
| 94 | 94 | }); |
| 95 | -$field->onGetValue(function () { |
|
| 95 | +$field->onGetValue(function() { |
|
| 96 | 96 | }); |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $value = (array) $value; |
| 68 | 68 | $return = array(); |
| 69 | 69 | $separator = $this->separator; |
| 70 | - array_walk_recursive($value, function ($item) use (&$return, $separator) { |
|
| 70 | + array_walk_recursive($value, function($item) use (&$return, $separator) { |
|
| 71 | 71 | if (is_string($item)) { |
| 72 | 72 | $item = explode($separator, $item); |
| 73 | 73 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $namespace = '\\Tacone\\Bees\\Field'; |
| 29 | 29 | $fields = ['string', 'integer', 'float', 'boolean']; |
| 30 | 30 | foreach ($fields as $class) { |
| 31 | - App::bind("bees.$class", function ($app, $arguments) use ($class, $namespace) { |
|
| 31 | + App::bind("bees.$class", function($app, $arguments) use ($class, $namespace) { |
|
| 32 | 32 | $class = Str::studly($class).'Field'; |
| 33 | 33 | $reflect = new ReflectionClass($namespace."\\$class"); |
| 34 | 34 | $instance = $reflect->newInstanceArgs($arguments); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | error_reporting(-1); |
| 21 | 21 | $me = $this; |
| 22 | - app()['events']->listen('composing:*', function ($view) use ($me) { |
|
| 22 | + app()['events']->listen('composing:*', function($view) use ($me) { |
|
| 23 | 23 | if (!empty($view['form'])) { |
| 24 | 24 | $this->widget = $view['form']; |
| 25 | 25 | } |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | Schema::dropIfExists('demo_article_category'); |
| 98 | 98 | |
| 99 | 99 | //create all tables |
| 100 | - Schema::table('demo_users', function ($table) { |
|
| 100 | + Schema::table('demo_users', function($table) { |
|
| 101 | 101 | $table->create(); |
| 102 | 102 | $table->increments('id'); |
| 103 | 103 | $table->string('firstname', 100); |
| 104 | 104 | $table->string('lastname', 100); |
| 105 | 105 | $table->timestamps(); |
| 106 | 106 | }); |
| 107 | - Schema::table('demo_articles', function ($table) { |
|
| 107 | + Schema::table('demo_articles', function($table) { |
|
| 108 | 108 | $table->create(); |
| 109 | 109 | $table->increments('id'); |
| 110 | 110 | $table->integer('author_id')->unsigned(); |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | $table->timestamp('publication_date'); |
| 116 | 116 | $table->timestamps(); |
| 117 | 117 | }); |
| 118 | - Schema::table('demo_article_detail', function ($table) { |
|
| 118 | + Schema::table('demo_article_detail', function($table) { |
|
| 119 | 119 | $table->create(); |
| 120 | 120 | $table->increments('id'); |
| 121 | 121 | $table->integer('article_id')->unsigned(); |
| 122 | 122 | $table->text('note'); |
| 123 | 123 | $table->string('note_tags', 200); |
| 124 | 124 | }); |
| 125 | - Schema::table('demo_comments', function ($table) { |
|
| 125 | + Schema::table('demo_comments', function($table) { |
|
| 126 | 126 | $table->create(); |
| 127 | 127 | $table->increments('id'); |
| 128 | 128 | $table->integer('user_id')->unsigned(); |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | $table->text('comment'); |
| 131 | 131 | $table->timestamps(); |
| 132 | 132 | }); |
| 133 | - Schema::table('demo_categories', function ($table) { |
|
| 133 | + Schema::table('demo_categories', function($table) { |
|
| 134 | 134 | $table->create(); |
| 135 | 135 | $table->increments('id'); |
| 136 | 136 | $table->integer('parent_id')->unsigned(); |
| 137 | 137 | $table->string('name', 100); |
| 138 | 138 | $table->timestamps(); |
| 139 | 139 | }); |
| 140 | - Schema::table('demo_article_category', function ($table) { |
|
| 140 | + Schema::table('demo_article_category', function($table) { |
|
| 141 | 141 | $table->create(); |
| 142 | 142 | $table->integer('article_id')->unsigned(); |
| 143 | 143 | $table->integer('category_id')->unsigned(); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $grid->text('id'); |
| 31 | 31 | $grid->text('title'); |
| 32 | 32 | $grid->text('author.fullname'); |
| 33 | - $grid->text('categories', 'In category')->value(function ($v) { |
|
| 33 | + $grid->text('categories', 'In category')->value(function($v) { |
|
| 34 | 34 | if ($v instanceof Collection) { |
| 35 | 35 | return implode(', ', $v->lists('name')); |
| 36 | 36 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $grid->start->before[] = '<p><em>Customized with a row callback</em></p>'; |
| 64 | 64 | $colors = ['success', 'warning', 'info', 'danger']; |
| 65 | 65 | $counter = 0; |
| 66 | - $grid->prototype->output(function ($row) use (&$counter, $colors) { |
|
| 66 | + $grid->prototype->output(function($row) use (&$counter, $colors) { |
|
| 67 | 67 | $row->class($colors[$counter]); |
| 68 | 68 | if ($colors[$counter] == 'danger') { |
| 69 | 69 | $row->end->after[] = '<tr><td colspan="1000" class="text-danger danger"> |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | return $query->where('title', 'like', '%'.$value.'%') |
| 34 | 34 | ->orWhere('body', 'like', '%'.$value.'%') |
| 35 | - ->orWhereHas('author', function ($q) use ($value) { |
|
| 35 | + ->orWhereHas('author', function($q) use ($value) { |
|
| 36 | 36 | $q->whereRaw(" CONCAT(firstname, ' ', lastname) like ?", array("%".$value."%")); |
| 37 | - })->orWhereHas('categories', function ($q) use ($value) { |
|
| 37 | + })->orWhereHas('categories', function($q) use ($value) { |
|
| 38 | 38 | $q->where('name', 'like', '%'.$value.'%'); |
| 39 | 39 | }); |
| 40 | 40 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | parent::boot(); |
| 45 | 45 | |
| 46 | - static::deleting(function ($article) { |
|
| 46 | + static::deleting(function($article) { |
|
| 47 | 47 | $article->detail()->delete(); |
| 48 | 48 | if ($article->photo) { |
| 49 | 49 | @unlink(public_path().'/uploads/demo/'.$article->photo); |