title: LaravelRalationship can't access
body: <p>First of all sorry for my bad english..
  I have a problem with model relationships, I can't access my data from controller and from view, could you help?</p>
  
  <p>I have two table category and categorydescription</p>
  
  <p><strong>categories table is going like this</strong> </p>
  
  <pre><code>Schema::create('categories', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('image', 255)-&gt;nullable();
              $table-&gt;integer('parent_id')-&gt;defaut(0);
              $table-&gt;tinyInteger('top');
              $table-&gt;integer('column');
              $table-&gt;integer('sort_order')-&gt;defaut(0);
              $table-&gt;tinyInteger('status');
              $table-&gt;timestamps();
          });
  </code></pre>
  
  <p>** categories_description table as you see **</p>
  
  <pre><code>Schema::create('categories_description', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;integer('categories_id')-&gt;unsigned();
              $table-&gt;foreign('categories_id')-&gt;references('id')-&gt;on('categories');
              // $table-&gt;foreign('language_id')-&gt;references('id')-&gt;on('languages');
              $table-&gt;string('name', 255);
              $table-&gt;text('description');
              $table-&gt;string('meta_title', 255);
              $table-&gt;string('meta_description', 255);
              $table-&gt;string('meta_keyword', 255);
              $table-&gt;timestamps();
          });
  </code></pre>
  
  <p>and I create two model for them Category model and CategoryDescription model **Thas are my model **</p>
  
  <pre><code>&lt;?php
  
  namespace App\Model;
  use Illuminate\Database\Eloquent\Model;
  
  class Category extends Model
  {
      public function selectQuery($sql_stmt) {
          return DB::select($sql_stmt);
      }
  
      public function sqlStatement($sql_stmt) {
          DB::statement($sql_stmt);
      }
  
      public function categorydescription() {
          return $this-&gt;hasMany('App\Model\CategoryDescription', 'categories_id', 'id');
      }
  }
  </code></pre>
  
  <p>and second model</p>
  
  <pre><code>&lt;?php
  
  namespace App\Model;
  
  use Illuminate\Database\Eloquent\Model;
  
  class CategoryDescription extends Model
  {
      protected $table = 'categories_description';
  
      public function selectQuery($sql_stmt) {
          return DB::select($sql_stmt);
      }
  
      public function sqlStatement($sql_stmt) {
          DB::statement($sql_stmt);
      }
  }
  </code></pre>
  
  <p>and my home controller code for fetching data</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Model\Category;
  use App\Model\CategoryDescription;
  
  class HomeController extends Controller
  {
      /**
       * Create a new controller instance.
       *
       * @return void
       */
      public function __construct()
      {
          // $this-&gt;middleware('auth');
          $this-&gt;categories = Category::with('categorydescription')-&gt;get(); // where('status', 1)-&gt;orderBy('created_at', 'desc')-&gt;
  
      }
  
      /**
       * Show the application dashboard.
       *
       * @return \Illuminate\Http\Response
       */
      public function index() {
  
          $res = $this-&gt;categories;
          foreach($res as $desc) {
              echo $desc-&gt;id;
              echo "&lt;br&gt;";
              foreach ($desc-&gt;categorydescription() as $key) {
                  echo "&lt;hr&gt;";
                  echo $key-&gt;id;
                  echo "&lt;hr&gt;";
              }
          }
  
          // die();
          // return view('home', [
          //     'title'         =&gt; 'Home',
          //     'categories'    =&gt; $this-&gt;categories,
          // ]);
      }
  }
  </code></pre>