Page MenuHomeDevCentral

No OneTemporary

diff --git a/app/Http/Controllers/LoginDashboardController.php b/app/Http/Controllers/LoginDashboardController.php
index c8c39d6..38559db 100644
--- a/app/Http/Controllers/LoginDashboardController.php
+++ b/app/Http/Controllers/LoginDashboardController.php
@@ -1,34 +1,41 @@
<?php namespace AuthGrove\Http\Controllers;
+use Illuminate\Support\Facades\Auth;
+
class LoginDashboardController extends Controller {
/*
|--------------------------------------------------------------------------
| Login dashboard Controller
|--------------------------------------------------------------------------
|
| This controller renders a dashsboard for users that are authenticated. It
| allows them to know they're already authenticated and to get information
| about their authentication data, methods and connections.
*/
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
- return view('home');
+ return view(
+ 'home',
+ [
+ 'user' => Auth::user()->getInformation(),
+ ]
+ );
}
}
diff --git a/app/User.php b/app/User.php
index 49d542d..33b528f 100644
--- a/app/User.php
+++ b/app/User.php
@@ -1,43 +1,62 @@
<?php namespace AuthGrove;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
use Authenticatable, CanResetPassword;
/**
* 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'];
+ public function getAttributes () {
+ $attributes = array_diff($this->fillable , $this->hidden);
+ $attributes[] = 'created_at';
+ $attributes[] = 'updated_at';
+ return $attributes;
+ }
+
+ /**
+ * Gets non sensible properties
+ */
+ 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, Jun 8, 08:00 (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3792685
Default Alt Text
(2 KB)

Event Timeline