You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
734 B
35 lines
734 B
3 years ago
|
<?php
|
||
|
|
||
|
namespace Database\Seeders;
|
||
|
|
||
|
use App\Models\User;
|
||
|
use Illuminate\Database\Seeder;
|
||
|
|
||
|
class create_user extends Seeder
|
||
|
{
|
||
|
/**
|
||
|
* Run the database seeds.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function run()
|
||
|
{
|
||
|
$userdata = [
|
||
|
["name" => "Marc"],
|
||
|
["name" => "Kirsten"],
|
||
|
["name" => "Michael"],
|
||
|
["name" => "Marita"],
|
||
|
["name" => "Heike"],
|
||
|
];
|
||
|
|
||
|
foreach ($userdata as $user) {
|
||
|
$usermodel = new User();
|
||
|
$usermodel->name = $user["name"];
|
||
|
$usermodel->save();
|
||
|
|
||
|
$token = $usermodel->createToken("token");
|
||
|
echo $user["name"] . " - " . $token->plainTextToken . "\n";
|
||
|
}
|
||
|
}
|
||
|
}
|