How to use custom table in laravel modal?



How to use custom table in laravel modal?..

Answer / Mujeeb Akhtar

To create a custom table in Laravel model, you can follow these steps: 1. Run the migration command 'php artisan make:model ModelName -m' to create both a new model and a migration file for your custom table. 2. In the generated migration file, define the schema for your custom table using the 'up()' method. 3. Execute the migration with 'php artisan migrate'. 4. After creating the table, you can use it in the respective model.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

Explain how to get current url in laravel?

1 Answers  


How can someone turn off csrf protection for a specific route?

1 Answers  


What are guards in laravel?

1 Answers  


What are some use valet commands?

1 Answers  


Please explain what is laravel?

1 Answers  


List out some artisan commands?

1 Answers  


How to use updateorinsert() method in laravel query?

1 Answers  


What is mvc framework?

1 Answers  


Explain dependency injection?

1 Answers  


What is contract in laravel?

1 Answers  


What are the benefits of laravel?

1 Answers  


Explain how to localize resource uris in laravel?

1 Answers  


Categories