Viewing File: /home/ubuntu/shop-website-base/database/seeders/StaticPageSeeder.php

<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;

class StaticPageSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        if(\Schema::hasTable('static_pages')) {

        	// Static pages

        	$static_pages = json_decode(json_encode(['about','privacy','terms','refund','cancellation','faq','help','contact','others']));

        	foreach ($static_pages as $key => $value) {

    			$page = \DB::table('static_pages')->where('type' ,$value)->count();

    			if(!$page) {

    				\DB::table('static_pages')->insert([

	         		[
				        'title' => $value,
				        'unique_id' => $value,
				        'description' => $value,
				        'type' => $value,
                        'status' => 1,
				        'created_at' => date('Y-m-d H:i:s'),
				        'updated_at' => date('Y-m-d H:i:s')
				    ],
				]);


    			}

        	}

		}
    }
}
Back to Directory File Manager