title: getting data from database in laravel using the username
body: <p>I have a table in database called 'User'. All I want is to get the basic information of the user. I've tried to get data from database but the thing that keep me bugging is that I get all the data inside the  table.
  <code>UserTable</code> </p>
  
  <pre><code>|id|username|firstname|lasttname|middlename|gender|age|birthdate|address|contact_number|designation|
   1   admin    lee       chiu      kim        male  47   07-22-87  cebu     0977452445    admin
   2   lrose    rose       loo      mar       female 27   04-02-88  cebu     0977452445    manager
   3   mgray    gray       men      try        male  37   01-22-89  cebu     0977452445    employee
  </code></pre>
  
  <p><code>UserProfile.php</code> --> Model</p>
  
  <pre><code>&lt;?php 
      class UserProfile  extends Eloquent   {
          public $timestamps=false;
          protected $table = 'users';
          protected $fillable=array('firstname','lastname', 'middlename', 'gender', 'age', 'birthdate', 'address', 'contact_number', 'designation');
      }
  </code></pre>
  
  <p>This is the model of my site.</p>
  
  <p><code>UserProfileContoller.php</code> --> Controller</p>
  
  <pre><code>&lt;?php
  class UserProfileController extends \BaseController {
      public function index($id)
      {
          $userprofile = User::find($id);
  
          return View::make('userprofile.index', array('userprofile' =&gt; $userprofile));
  
          //return View::make('userprofile.index')-&gt;with('UserProfiles',UserProfile::get());
      }
  </code></pre>
  
  <p>For example I am currently log in to username admin and I want to edit and view my profile. How can I get the data just for admin only. Please Help.</p>
  
  <p>The situation hers is that. let say they have 3 employees. So in the table 3 username. lets assume that I'm not the admin. I will log in using lrose. and the other one log in as admin and so.on. If the three of us will go to our profiles the only thing to display there is their own profile and can edit it.</p>