For Monday
parent
b6890ce2c2
commit
fe195f3077
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class ThreadsCollection extends ResourceCollection
|
||||
{
|
||||
/**
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection
|
||||
];
|
||||
}
|
||||
|
||||
public function getCreators() {
|
||||
foreach($this->collection as &$t) {
|
||||
$creator = $t->creator;
|
||||
//dd($creator->name);
|
||||
$t->creator_name = $creator->name;
|
||||
}
|
||||
dd($this->collection);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class TagThreadTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('tag_thread')->insert([
|
||||
'tag_id' => 1,
|
||||
'thread_id' => 2
|
||||
]);
|
||||
|
||||
DB::table('tag_thread')->insert([
|
||||
'tag_id' => 2,
|
||||
'thread_id' => 2
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class TagsTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('tags')->insert([
|
||||
'tag_text' => "Fortnite",
|
||||
'creator_id' => 1
|
||||
]);
|
||||
|
||||
DB::table('tags')->insert([
|
||||
'tag_text' => "Multiplayer",
|
||||
'creator_id' => 1
|
||||
]);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
||||
{
|
||||
"/js/app.js": "/js/app.js",
|
||||
"/css/app.css": "/css/app.css"
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div id="app">
|
||||
<div class="container">
|
||||
<thread-component></thread-component>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
Loading…
Reference in New Issue