PHP code example of ericli1018 / laravel-kendo-ui-datasource

1. Go to this page and download the library: Download ericli1018/laravel-kendo-ui-datasource library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ericli1018 / laravel-kendo-ui-datasource example snippets


$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];

$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];