Skip to content

Commit

Permalink
Merge branch 'main' of github.com-rx:rxcod9/joy-voyager-datatable int…
Browse files Browse the repository at this point in the history
…o main
  • Loading branch information
rxcod9 committed Jun 25, 2021
2 parents eb7aaf2 + 044df48 commit cfa1355
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"php":"8.0.5","version":"3.0.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["method","property"]},"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"sort_algorithm":"alpha"},"no_unused_imports":true},"hashes":{"config\/voyager-datatable.php":1484065835,"src\/Http\/helpers.php":1075860266,"src\/Http\/Controllers\/VoyagerUserController.php":3486565011,"src\/Http\/Controllers\/VoyagerBaseController.php":4108125272,"src\/VoyagerDatatableServiceProvider.php":542068121,"src\/DataTypeDataTable.php":3382148523,"routes\/web.php":1896347483,"routes\/api.php":2512016892,"tests\/TestCase.php":2979706050}}
{"php":"8.0.5","version":"3.0.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":{"allow_single_line_closure":true},"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["method","property"]},"encoding":true,"full_opening_tag":true,"array_indentation":true,"array_syntax":{"syntax":"short"},"combine_consecutive_unsets":true,"class_attributes_separation":{"elements":{"method":"one"}},"multiline_whitespace_before_semicolons":true,"single_quote":true,"binary_operator_spaces":{"operators":{"=>":"align_single_space_minimal","=":"align_single_space_minimal"}},"concat_space":{"spacing":"one"},"declare_equal_normalize":true,"function_typehint_space":true,"single_line_comment_style":{"comment_types":["hash"]},"include":true,"lowercase_cast":true,"no_extra_blank_lines":{"tokens":["case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use","use_trait"]},"no_multiline_whitespace_around_double_arrow":true,"no_spaces_around_offset":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"object_operator_without_whitespace":true,"phpdoc_align":true,"phpdoc_no_useless_inheritdoc":true,"single_blank_line_before_namespace":true,"space_after_semicolon":true,"ternary_operator_spaces":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true},"hashes":{"src\/Http\/helpers.php":921454369,"src\/Http\/Controllers\/VoyagerUserController.php":3486565011,"src\/Http\/Controllers\/VoyagerBaseController.php":4176581034,"src\/VoyagerDatatableServiceProvider.php":3973386622,"src\/DataTypeDataTable.php":2024636848,"tests\/TestCase.php":723374736}}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Joy VoyagerDatatable

This [Laravel](https://laravel.com/)/[Voyager](https://voyager.devdojo.com/) module adds Yajra DataTable to Voyager.
This [Laravel](https://laravel.com/)/[Voyager](https://voyager.devdojo.com/) module adds Yajra Async/Ajax DataTable to Voyager.

By 🐼 [Ramakant Gangwar](https://github.com/rxcod9).

![Screenshot](https://raw.githubusercontent.com/rxcod9/joy-voyager-datatable/main/cover.jpg)

[![Latest Version](https://img.shields.io/github/v/release/rxcod9/joy-voyager-datatable?style=flat-square)](https://github.com/rxcod9/joy-voyager-datatable/releases)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rxcod9/joy-voyager-datatable/run-tests?label=tests)
[![Total Downloads](https://img.shields.io/packagist/dt/joy/voyager-datatable.svg?style=flat-square)](https://packagist.org/packages/joy/voyager-datatable)
Expand Down Expand Up @@ -42,7 +44,7 @@ In order to override views delivered by Voyager DataTable, copy contents from ``

## Working Example

You can try laravel demo example from [https://github.com/rxcod9/joy-voyager-datatable-laravel-demo](https://github.com/rxcod9/joy-voyager-datatable-laravel-demo).
You can try laravel demo example from [https://github.com/rxcod9/joy-voyager-datatable-laravel-demo](https://github.com/rxcod9/joy-voyager-datatable-laravel-demo) and a demo is hosted here [https://joy-voyager-datatable.herokuapp.com/admin/users/datatable](https://joy-voyager-datatable.herokuapp.com/admin/users/datatable).

## Documentation

Expand Down
Binary file added cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/DataTypeDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DataTypeDataTable extends EloquentDataTable
/**
* Can the DataTable engine be created with these parameters.
*
* @param mixed $source
* @param mixed $source
* @return bool
*/
public static function canCreate($source)
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/VoyagerBaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function ajax(Request $request)
// Define orderColumn
$orderColumn = [];
if ($orderBy) {
$index = $dataType->browseRows->where('field', $orderBy)->keys()->first()
$index = $dataType->browseRows->where('field', $orderBy)->keys()->first()
+ ($showCheckboxColumn ? 1 : 0);
$orderColumn = [[$index, $sortOrder ?? 'desc']];
}
Expand Down
11 changes: 5 additions & 6 deletions src/VoyagerDatatableServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ protected function loadDatatablesEngines(): void
foreach ($engines as $engine => $class) {
$engine = Str::camel($engine);

if (! method_exists(DataTables::class, $engine) && ! DataTables::hasMacro($engine)) {
if (!method_exists(DataTables::class, $engine) && !DataTables::hasMacro($engine)) {
DataTables::macro($engine, function () use ($class) {
if (! call_user_func_array([$class, 'canCreate'], func_get_args())) {
if (!call_user_func_array([$class, 'canCreate'], func_get_args())) {
throw new \InvalidArgumentException();
}

Expand All @@ -100,7 +100,6 @@ public function register()
$this->registerCommands();
}


/**
* Register publishables.
*
Expand All @@ -110,21 +109,21 @@ protected function registerPublishables(): void
{
$this->publishes(
[
__DIR__ . '/../config/voyager-datatable.php' => config_path('joy-voyager-datatable.php'),
__DIR__ . '/../config/voyager-datatable.php' => config_path('joy-voyager-datatable.php'),
],
'config'
);

$this->publishes(
[
__DIR__ . '/../resources/views' => resource_path('views/vendor/joy-voyager-datatable'),
__DIR__ . '/../resources/views' => resource_path('views/vendor/joy-voyager-datatable'),
],
'views'
);

$this->publishes(
[
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/joy-voyager-datatable'),
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/joy-voyager-datatable'),
],
'translations'
);
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public function setUp(): void

protected function loadEnvironmentVariables()
{
if (! file_exists(__DIR__.'/../.env')) {
if (!file_exists(__DIR__ . '/../.env')) {
return;
}

$dotEnv = Dotenv::createImmutable(__DIR__.'/..');
$dotEnv = Dotenv::createImmutable(__DIR__ . '/..');

$dotEnv->load();
}
Expand All @@ -35,7 +35,7 @@ protected function loadEnvironmentVariables()
*/
protected function getPackageProviders($app)
{
$serviceProviders = [
$serviceProviders = [
ApiServiceProvider::class,
];

Expand All @@ -49,9 +49,9 @@ protected function getEnvironmentSetUp($app)
{
config()->set('database.default', 'sqlite');
config()->set('database.connections.sqlite', [
'driver' => 'sqlite',
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
'prefix' => '',
]);
}

Expand Down

0 comments on commit cfa1355

Please sign in to comment.