You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
1.9 KiB
PHP
93 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Thread;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ThreadController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
$threads = Thread::orderBy('created_at', 'desc')->paginate(20);
|
|
|
|
return Thread::collection($threads);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create()
|
|
{
|
|
return view("create_thread");
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
$thread = new Thread;
|
|
|
|
$thread->thread_title = $request->thread_title;
|
|
$thread->thread_poster_id = $request->user_id;
|
|
|
|
$thread->save();
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param \App\Thread $thread
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show(Thread $thread)
|
|
{
|
|
return view("thread_view")->withThread($thread);
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param \App\Thread $thread
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function edit(Thread $thread)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \App\Thread $thread
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update(Request $request, Thread $thread)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*
|
|
* @param \App\Thread $thread
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function destroy(Thread $thread)
|
|
{
|
|
//
|
|
}
|
|
}
|