Page MenuHomeDevCentral

No OneTemporary

diff --git a/app/User.php b/app/User.php
index 7dc225e..e0a076c 100644
--- a/app/User.php
+++ b/app/User.php
@@ -1,70 +1,90 @@
<?php namespace AuthGrove;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use AuthGrove\Services\FindableByAttribute;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
use Authenticatable, CanResetPassword, FindableByAttribute;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['username', 'fullname', 'email', 'password'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
/**
* Gets fillable but not hidden attributes, plus create/update time
*
* @return Array
*/
public function getAttributes () {
$attributes = array_diff($this->fillable , $this->hidden);
$attributes[] = 'created_at';
$attributes[] = 'updated_at';
return $attributes;
}
+ /**
+ * Localizes attribute
+ *
+ * @param string $attribute The attribute to localize
+ * @return string The localized name of the attribute
+ */
+ public static function localizeAttribute ($attribute) {
+ return trans("panel.user-attributes.$attribute");
+ }
+
+ /**
+ * Gets default attributes
+ *
+ * @return Array an array of string, each a default attribute of the model
+ */
+ public static function getDefaultAttributes () {
+ $user = new self();
+ return $user->getAttributes();
+ }
+
/**
* Gets non sensible properties
*
* @return Array
*/
public function getInformation () {
$info = [];
$attributes = $this->getAttributes();
foreach ($attributes as $attribute) {
$info[$attribute] = $this->attributes[$attribute];
}
return $info;
}
/**
* Gets the full name of an user, or if not defined, the username.
*/
public function getName () {
if ($this->attributes['fullname'] !== "") {
return $this->attributes['fullname'];
}
return $this->attributes['username'];
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 16:06 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260496
Default Alt Text
(2 KB)

Event Timeline