corcel / corcel

Use WordPress backend with Laravel or any PHP application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use corcel in WordPress plugin for custom tables

developerpaddy opened this issue · comments

  • Corcel Version: recent
  • Framework Name & Version:
  • PHP Version: 7.4.*
  • Database Driver & Version:

Description:

Hello friends,

Thanks for the great work.
I have used corcel in php but I want to use in WordPress.
I am very happy that I can use eloquent in WordPress.

I know same question has been asked previously, but some where my requirements are different.
#101

I want to use corcel in my WordPress plugin so that I can use custom table to save my plugin related data and use all the ORM to work with my data. I found corcel is useful in my case.

I tried but I am having an issue while initializing the database. I used DB_NAME, DB_PASSWORD constants from wp_config.php file but got PDO_EXCEPTION error cannot connect to database.

I think if I connect to database then it will be easy to setup cocel in WordPress plugin. Any example would be much appreciated.

Steps To Reproduce: