No Problem setting GC Enterprise,
- Using Composer
- Using Codeigniter
its run perfectly. This is awesome !!!
Now im gonna setup for Laravel
im Running on Laravel/framework": "5.8.*",
Follow this tuts at https://www.grocerycrud.com/enterprise/enterprise-documentation/laravel-installation for laravel installation
app/Http/Controllers/
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use GroceryCrud\Core\GroceryCrud; class CustomersController extends Controller { /** * * @return \Illuminate\Http\Response */ public function index() { // } /** * Show the datagrid for customers * * @return \Illuminate\Http\Response */ public function datagrid() { die("Hello World!"); } }
datagrid has just a response “Hello World!†perfectly
when use the final controller
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use GroceryCrud\Core\GroceryCrud; class CustomersController extends Controller { /** * * @return \Illuminate\Http\Response */ public function index() { // } private function _getDatabaseConnection() { $databaseConnection = config('database.default'); $databaseConfig = config('database.connections.' . $databaseConnection); return [ 'adapter' => [ 'driver' => 'Pdo_Mysql', 'database' => $databaseConfig['database'], 'username' => $databaseConfig['username'], 'password' => $databaseConfig['password'], 'charset' => 'utf8' ] ]; } /** * Show the datagrid for customers * * @return \Illuminate\Http\Response */ public function datagrid() { $database = $this->_getDatabaseConnection(); $config = config('grocerycrud'); $crud = new GroceryCrud($config, $database); $crud->setTable('customers'); $crud->setSubject('Customer', 'Customers'); $output = $crud->render(); if ($output->isJSONResponse) { return response($output->output, 200) ->header('Content-Type', 'application/json') ->header('charset', 'utf-8'); } $css_files = $output->css_files; $js_files = $output->js_files; $output = $output->output; return view('default_template', [ 'output' => $output, 'css_files' => $css_files, 'js_files' => $js_files ]); } }
php artisan serve
http://localhost:8000/customers
it keep show
Ooooops, something went wrong! If you can see this message, this is probably a misconfiguration in Grocery CRUD Enterprise!
do i miss something ?
my .env
APP_NAME=Laravel APP_ENV=local APP_KEY=base64:6HBHAx3x6mt8QndO54NXrPhaiEnSZpa1/KXf9Xg8+5E= APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=stack DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=test_database DB_USERNAME=root DB_PASSWORD= BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120 REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
my config/database.php
'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ 'driver' => 'mysql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'test_database'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ],
i think im doing wrong for database connection. any clue ???