Multiple database connection with same table manes laravel [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have two database having tables with same name.
I am using laravel to connect through this.
Note : I am able to make multiple connections but I am unable to access tables having same name.
Example
Database 1 :
Table: ads
Database 2
Table: ads
How can I make database connection / model for these two different tables having same name , which are in two different databases.

refer your tables with db names... for example db1.ads & db2.ads ... hope it helps

Related

store users in one table or multiple table Laravel [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 21 hours ago.
Improve this question
we are creating an e-learning website with Laravel, and we have multiple users (student, instructor, admin) should we store them in one table (users) or each user with own table.
I want to know if there is a convention
There is no set in stone rule, it is totally up to you. But from what I see in most Laravel projects, and what I do in my projects as well, to make it easier to read/troubleshoot you use a single "users" table and make a "profile" or "profile_type" column to determine which one are they attached to.

PHP & MYSQL tables [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to figure it out this simple issue. I have two tables
1) Services
2) Projects
Some projects are using only one service_id (ex: web dev), but other are connected with two or three of them (ex: web dev, branding) and I have only one table call service_id. How can I add more than just one service_id?
Services
Projects
Like #ccKep wait, you need to create a table to link Services with Projects. So your database structure would look like:
You can then combine as many services to as many projects as you want. Projects_has_Services contains pairs of (service_id, project_id).

Web service to insert and view database data [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I need a web-service which allows admins to insert new data and viewers to see this data-tables. Therefore at first i need a database (Mysql ?). Is a mySql db on a server the right choice? Afterwards a website should be connected to this db, where users can see specific tables and admins can add new lines into this tables. Finally this tables should be able to only show the last xy-lines of the respective table.
Use-case: I have a restaurant, and when I get orders, i want to provide a simple table where the telephone-workers can add new orders (e.g. 3x pizza salami); afterwards this table is opened with view-rights on a display in the kitchen. So the chefs can create the orders.
Which database is the optimal here?
What kind of web-service is the right and how is this connected and set up?
You can use MySQL or SQL Server. And you can use Web Pages instead of web-service.

In laravel project , how to create a new database and some tables in that database ,then switch back to original database. [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
In normal php we can chage the connection using con at any time. how to do same in laravel?
In laravel project , how to create a new database and some tables in that database ,then switch back to original database?
You can configure diffrent database connections in config/database.php
file then you can access each connection via the connection method on the DB facade.
For more information check this link :
https://laravel.com/docs/5.3/database#using-multiple-database-connections

Need to handle large database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am having table with 9 columns and 400000 Records. I am using php and mysql for database. The problem I am facing is it takes quite a long time to fetch the particular data or search the records. So can anyone please suggest me should I use other database or some twicks to do in database and also sugegst me the best hosting to handle this large records in my site.
this much record is not considered as a large data. What you need to do is make sure you have proper indexing in your table columns and most important to load only those data which are required. i.e. Implement paging.

Categories