Please watch this free series. It will answer all of your questions and more. https://laracasts.com/series/laravel-from-scratch-2017
HAS MANY RELATIONSHIP GUIDE USING ELOQUENT ORM
Hello pls am a kind of stuck with Eloquent ORM relationship issue, I have three tables comments, replies and users table respectively. I want to create a relationship for the three tables so that I can get my result in one raw per relationship Below is the tables architecture .
Schema::create('comments', function (Blueprint $table) { $table->increments('id'); $table->string('postedby'); //user_id $table->text('comment'); $table->timestamps(); });
Schema::create('replies', function (Blueprint $table) { $table->increments('id'); $table->string('user_id'); $table->integer('comment_id')->unsigned(); $table->text('reply'); $table->timestamps(); });
Schema::create('users', function (Blueprint $table) { $table->string('id'); $table->string('name'); $table->string('surname'); $table->string('email')->unique(); $table->string('password');
});
PLS HELP ME WITH THE RELATIONSHIP AND THE CONTROLLER QUERY CODE AS SAMPLE
Please or to participate in this conversation.