1. Go to this page and download the library: Download dongm2ez/general-db 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/ */
dongm2ez / general-db example snippets
'providers' => [
// Other service providers...
Dongm2ez\Db\DbServiceProvider::class,
],
namespace App\Repositories;
class ExampleRepository extends \Dongm2ez\Db\AbstractRepository
{
protected function init()
{
$this->model = new ExampleModel();
}
}
namespace App\Services;
class ExampleService extends \Dongm2ez\Db\AbstractService
{
public function getAllList($params)
{
$extends = $this->listParamsFormat($params);
$input = $this->listFillableFromArray($params, [
'id',
'user_id',
'create_at',
'update_at',
]);
$result = (new \App\Repositories\ExampleRepository())->getList(array_merge($input, ['_extends' => $extends]));
return $result;
}
}
namespace App\Http\Controller;
class ExampleController extends Controller
{
public function lists(Request $request)
{
$masterData = (new \App\Services\ExampleService)->getAllList($request->all());
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.