Tag : Schema


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 | | 2173 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 | | 4315 Viewer | Category : Laravel
READ MORE

    AngularJS - How to render HTML value in ng-repeat ?

    AngularJS - How to render HTML value in ng-repeat ?

    Open Post

    Bootstrap - Show/Hide(toggle) Password input field using bootstrap-show-password.js Plugin

    Bootstrap - Show/Hide(toggle) Password input field using bootstrap-show-password.js Plugin

    Open Post

    How to create middleware for XSS protection in laravel 5?

    How to create middleware for XSS protection in laravel 5?

    Open Post

    PHP - How to convert HTML file to PDF using Dompdf library?

    PHP - How to convert HTML file to PDF using Dompdf library?

    Open Post

    Laravel - How to generate RSS Feed using roumen/feed package?

    Laravel - How to generate RSS Feed using roumen/feed package?

    Open Post

    AngularJS - simple image upload with preview example in PHP

    AngularJS - simple image upload with preview example in PHP

    Open Post