⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Laravel installation with GC Enterprise, misconfiguration in Grocery CRUD Enterprise!



kaharudin30

kaharudin30
  • profile picture
  • Member

Posted 10 August 2019 - 12:44 PM

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 ???

 

 

 

 

 

 

 

 

 

 

 

 

 


web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 21 August 2019 - 09:22 AM

Hello @kaharudin30,

 

This is probably because of the new version of Laravel. I will have it a look and let you know.

 

Regards

Johnny


arif-rh

arif-rh
  • profile picture
  • Member

Posted 15 November 2019 - 07:24 AM

As It mention in message, that is probably missconfiguration in Grocery Crud Enterprise.

 

My suggestion is to check config/grocerycrud.php too and make sure value of assets_folder is the right path.