ericli1018 / laravel-kendo-ui-datasource
Kendo UI datasource for Laravel
1.0.13
2022-07-19 06:34 UTC
Requires
- php: >=7.4.0
- laravel/framework: >=7.0
Requires (Dev)
- mockery/mockery: dev-master
README
ESSENTIALLY ALL WORK ON THIS PROJECT WAS ORIGINALLY DONE BY USER meowcakes. I HAVE FORKED THIS FROM ChemProf MERELY TO GIVE MYSELF CONTROL OVER THE DEPENDENCY VERSIONS. I TAKE NO CREDIT OR RESPONSIBILITY FOR THE ORIGINAL SCRIPTS, OTHER THAN THE TRIVIAL ADJUSTMENTS I HAVE MADE.
Server side Kendo UI DataSource implementation for Laravel
Version
Installation
Start by installing Laravel Kendo UI Datasoure if you have not done so already:
composer require ericli1018/laravel-kendo-ui-datasource
To get the latest version simply require it in your composer.json
file.
"ericli1018/laravel-kendo-ui-datasource": "dev-main"
(Optional) You can register the facade in the aliases
key of your app/config/app.php
file.
Default alias is "KendoDataSource".
'aliases' => array(
'KendoDataSource' => 'Ericli1018\LaravelKendoUiDatasource\Facade',
)
Basic Example
$kendoUIDS = KendoDataSource::make( $request->all(), [ // (Optional) specifying table, join table or table alias for query. // 'email' => ['string', 'join_table_name'], 'id' => 'number', 'name' => 'string', 'created_at' => 'date', 'fully_registered' => 'boolean', ], // Option main table name for query // 'main_table_name' ); $query = (new App\Models\User())->newQuery(); $count = $kendoUIDS->execute($query); // Option column name for count // $count = $kendoUIDS->execute($query, 'column name'); return ['data' => $query->get()->toArray(), 'total' => $count];
Example with Table Alias
$kendoUIDS = KendoDataSource::make( $request->all(), [ 'id' => ['number', 'm'], 'email' => ['string'], 'name' => 'string', ], 'm' ); $query = (new App\Models\User())->newQuery()->from('users as m'); $count = $kendoUIDS->execute($query, '`m`.`id`'); return ['data' => $query->get()->toArray(), 'total' => $count];