Tag : Migration


Laravel - How to remove foreign key constraint using migration?

Sometimes it can be agreeable to remove a database column that hosts a foreign key relationship, and we add wrong column with foreign key constraint on table, At that time we must remove that column from table. But we can't remove directly using dropColumn() because we did apply foreign key constraint so we should drop foreign key constraint of that column using dropForeign() and then we can delete column using dropColumn(). You can see as bellw migration, first i added migration with wrong column then other migration for remove that column. <strong>Wrong Column Migration:</strong> <pre cla.....

By Hardik Savani | July 1, 2016 | | 1108 Viewer | Category : Laravel
READ MORE

How to check column exists or not in table Laravel 5

When i was working my laravel application at that time i need to remove column from database. But i am not sure that column is exists or not in tables. So i was thinking, but i found solution from Laravel Database Migration Schema. we can check column is exists or not in tabales using hasColumn. If you also need to remove if column is exists then you can use bellow example. <strong>Example:</strong> <pre class="prettyprint lang-php"> if (Schema::hasColumn('subscriptions', 'stripe_id')) { Schema::table('subscriptions', function ($table) { $table->dropColumn('stripe_id'); }); } <.....

By Hardik Savani | May 4, 2016 | | 1100 Viewer | Category : Laravel
READ MORE

How to check table is exists or not in Laravel 5?

Laravel provide database migrations using Schema facade. Schema facade have sevaral method like add column, remove column, check if table exists, check if column exists etc. In bellow example you can see how to detect if a database table exists with Schema Builder. We somtimes need to check if table exists then to do something etc. So you can check this way: <strong>Example:</strong> <pre class="prettyprint lang-php"> Schema::hasTable('yourTable'); </pre>

By Hardik Savani | April 20, 2016 | | 2275 Viewer | Category : Laravel
READ MORE

How to solve 'There are no commands defined in the "cashier" namespace' in Laravel 5

When i did start to learn "Laravel Cashier" and i was following step by step of laravel official document, but i run bellow command : <pre>php artisan cashier:table users</pre> At that time i found following error on my terminal: <pre>[Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "cashier" namespace.</pre> I try to solve this error, i also clear all cache and add service provider, it means i try totally and i can't found solution for this error, but you can also add migration like this way if you want it is a same like we did bellow c.....

By Hardik Savani | April 6, 2016 | | 2582 Viewer | Category : Laravel
READ MORE

    Bootstrap - Jquery multiple select with checkboxes example using bootstrap-multiselect.js plugin

    Bootstrap - Jquery multiple select with checkboxes example using bootstrap-multiselect.js plugin

    Open Post

    Bootstrap - Input multiple tags example using Tag Manager Jquery Plugin

    Bootstrap - Input multiple tags example using Tag Manager Jquery Plugin

    Open Post

    Paypal payment gateway integration in php source code example

    Paypal payment gateway integration in php source code example

    Open Post

    Laravel 5.3 - How to create SEO friendly sluggable URL

    Laravel 5.3 - How to create SEO friendly sluggable URL

    Open Post

    Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.

    Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.

    Open Post

    How to create custom facade in laravel 5.2?

    How to create custom facade in laravel 5.2?

    Open Post