Reputation: 1666
I am trying to hash my password before inserting it into my table using a laravel seed. Every time I run php artisan db:seed --class=users
I get the error "Class 'hash' not found"
Here is my class:
class users extends Seeder {
public function run()
{
User::create(array(
'email' => '********',
'password' => hash::make('********')
));
$this->command->info('User table seeded!');
}
}
Let me know if there is any more information that you need. Thanks!
Upvotes: 0
Views: 2854
Reputation: 15629
You have to use Hash::make()
, because the case matters. In common it's a good practise to use some coding guidelines to prevent errors of this sort.
In your case, you should write every classname in upper camelcase
class Users extends Seeder {
public function run()
{
User::create(array(
'email' => '********',
'password' => Hash::make('********')
));
$this->command->info('User table seeded!');
}
}
Upvotes: 1