Skip to content

Instantly share code, notes, and snippets.

@Kindari
Last active December 11, 2015 22:39
Show Gist options
  • Select an option

  • Save Kindari/4670861 to your computer and use it in GitHub Desktop.

Select an option

Save Kindari/4670861 to your computer and use it in GitHub Desktop.
<?php // application/models/user.php
class User extends Eloquent
{
public static $hidden = array('password');
public function set_password($value)
{
return $this->attributes['password'] = Hash::make($value);
}
}
<?php // application/tasks/user.php
class User_Task {
public function run($arguments)
{
// Do awesome notifying...
}
public function make($arguments)
{
if (count($arguments) != 2)
{
echo "Usage: php artisan user:make username password" . PHP_EOL;
exit;
}
list($username, $password) = $arguments;
$user = User::create( compact('username', 'password') );
echo "Created user #{$user->id}" . PHP_EOL;
}
}
@FrostyX

FrostyX commented Feb 3, 2013

Copy link
Copy Markdown

Hi, my problem is obvious. I haven't columnt username.

$[FrostyX  blog]-> php artisan user:make myUser myPassword
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'username' in 'field list'

SQL: INSERT INTO `Users` (`username`, `Password`, `updated_at`, `created_at`) VALUES (?, ?, ?, ?)

Bindings: array (
  0 => 'myUser',
  1 => '$2a$08$hfWEetzmwpetlP.QSYOfLesDBBQEaPrFuf8fABUDwp4he2kk3eFcG',
  2 => '2013-02-02 23:57:28',
  3 => '2013-02-02 23:57:28',
)

But that is it. I do not want to have this column. Instead I want column Email as login. Where can I set user's properites?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment