Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data from a SQL Server #113

Closed
guillermohaad opened this issue Sep 17, 2016 · 8 comments
Closed

data from a SQL Server #113

guillermohaad opened this issue Sep 17, 2016 · 8 comments
Labels

Comments

@guillermohaad
Copy link

I'm working with BackPack\CRUD, I need to show display data from a SQL Server table in a Dropdwon control. I could already connect but displays a blank page in the view?

I need to change anything else?

Deputy evidence

image

@tabacitu
Copy link
Member

Hi @guillermohaad ,

What column type triggers the error? If you remove the columns one by one, which one is the problem? Then copy-paste your code, please.

Cheers!

@guillermohaad
Copy link
Author

guillermohaad commented Sep 19, 2016

friend @tabacitu
remove the columns and does nothing.
Connection files and do their job.

attached below code model and controller

model

hasMany('App\Models\vehiculo', 'vehicle_tipo'); } ``` /* |-------------------------------------------------------------------------- | SCOPES |-------------------------------------------------------------------------- */ /* |-------------------------------------------------------------------------- | ACCESORS |-------------------------------------------------------------------------- */ /* |-------------------------------------------------------------------------- | MUTATORS |-------------------------------------------------------------------------- */ ``` } ## controler crud->setModel("App\Models\Vehiculos"); $this->crud->setRoute("admin/vehiculos"); $this->crud->setEntityNameStrings('vehiculos', 'vehiculos'); //$this->crud->allowAccess('reorder'); //$this->crud->enableReorder('placa', 2); /* |-------------------------------------------------------------------------- | BASIC CRUD INFORMATION |-------------------------------------------------------------------------- */ $this->crud->setColumns(['entcode']); $this->crud->setColumns(['entetpcode']); $this->crud->addField([ 'name' => 'entcode', 'label' => "Placa" ]); $this->crud->addField([ 'name' => 'entetpcode', 'label' => 'Tipo', ]); $this->crud->setFromDb(); // ------ CRUD FIELDS // $this->crud->addField($options, 'update/create/both'); // $this->crud->addFields($array_of_arrays, 'update/create/both'); // $this->crud->removeField('name', 'update/create/both'); // $this->crud->removeFields($array_of_names, 'update/create/both'); // ------ CRUD COLUMNS // $this->crud->addColumn(); // add a single column, at the end of the stack // $this->crud->addColumns(); // add multiple columns, at the end of the stack // $this->crud->removeColumn('column_name'); // remove a column from the stack // $this->crud->removeColumns(['column_name_1', 'column_name_2']); // remove an array of columns from the stack // $this->crud->setColumnDetails('column_name', ['attribute' => 'value']); // $this->crud->setColumnsDetails(['column_1', 'column_2'], ['attribute' => 'value']); // ------ CRUD ACCESS // $this->crud->allowAccess(['list', 'create', 'update', 'reorder', 'delete']); // $this->crud->denyAccess(['list', 'create', 'update', 'reorder', 'delete']); // ------ CRUD REORDER // $this->crud->enableReorder('label_name', MAX_TREE_LEVEL); // NOTE: you also need to do allow access to the right users: $this->crud->allowAccess('reorder'); // ------ CRUD DETAILS ROW // $this->crud->enableDetailsRow(); // NOTE: you also need to do allow access to the right users: $this->crud->allowAccess('details_row'); // NOTE: you also need to do overwrite the showDetailsRow($id) method in your EntityCrudController to show whatever you'd like in the details row OR overwrite the views/backpack/crud/details_row.blade.php // ------ AJAX TABLE VIEW // Please note the drawbacks of this though: // - 1-n and n-n columns are not searchable // - date and datetime columns won't be sortable anymore // $this->crud->enableAjaxTable(); // ------ ADVANCED QUERIES // $this->crud->addClause('active'); // $this->crud->addClause('type', 'car'); // $this->crud->addClause('where', 'name', '==', 'car'); // $this->crud->addClause('whereName', 'car'); // $this->crud->addClause('whereHas', 'posts', function($query) { // $query->activePosts(); // }); // $this->crud->orderBy(); // $this->crud->groupBy(); // $this->crud->limit(); } public function store(StoreRequest $request) { return parent::storeCrud(); } public function update(UpdateRequest $request) { return parent::updateCrud(); } ``` ## }

@tabacitu
Copy link
Member

...I have no idea...

If you create the same table in MySQL and use that, does it work? Do you have any way to test that?

Cheers!

@guillermohaad
Copy link
Author

I create the same table in MySQL It works well, not problem.

@tabacitu
Copy link
Member

Damn. SQL Server it's not officially supported by Backpack and I have no way to test it, but unofficially, Eloquent should take care of every database operation, no matter the DBMS.

  1. Do other SQL Server tables work for you in Backpack?
  2. You can debug to see what the error is by moving a dd('got here'); around in your constructor until you see what line is causing it;
  3. If the error is not in your constructor, you can do the same dd() trick inside vendor/backpack/crud/src/app/Http/Controllers/CrudController.php's index() method;

Cheers!

@guillermohaad
Copy link
Author

hi friend @tabacitu ,I did what you said but shows no errors. I'm puzzled.

@tabacitu
Copy link
Member

Hi @guillermohaad . It isn't supposed to show errors. The dd() represents "dump this message and die (kill the application)". So if you do end up seeing the message, you'll know the processing gets there. And you need to move the dd() one more line below. When you stop seeing the message, you'll know the line before it was the problem.

It's pretty difficult to do, but it's the only way, I think.

Cheers!

@guillermohaad
Copy link
Author

I understand my friend, I'll try to get the error.

@tabacitu tabacitu added the Bug label Sep 27, 2016
This was referenced Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants