Laravel Code
Laravel Code
Laravel Code
';
charset=utf8',DATABASE_USER,DATABASE_PASSWORD);
// $DB->setFetchMode(PDO::FETCH_ASSOC);
// $db = new
PDO('mysql:host='.DATABASE_HOST.';dbname='.DATABASE_NAME.';charset=utf8',
DATABASE_USER, DATABASE_PASSWORD);
###################################
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('blogs')->delete();
$faker = Faker\Factory::create();
DB::table('blogs')->insert([
'titre' => $faker->text(50),
'texte' => $faker->text,
'created_at' => $date,
'updated_at' => $date
]);
}
}
###########################
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// $this->call(UserTableSeeder::class);
$this->call(blogsTableSeeder::class);
}
}
###########################
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::drop('blogs');
}
}
########################
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
<script src="/resources/js/bootstrap.js"></script>