Created
March 8, 2022 10:59
-
-
Save brain2xml/0b50d8fc3c317fe11a40dd21aeff7f78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Http\Requests\StoreWordRequest; | |
use App\Http\Requests\UpdateWordRequest; | |
use App\Models\Word; | |
class WordController extends Controller | |
{ | |
/** | |
* Display a listing of the resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
$words = Word::paginate('15'); | |
return view('words.list', ['words'=>$words]); | |
} | |
/** | |
* Show the form for creating a new resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function create() | |
{ | |
return view('words.create', ['word'=>new Word()]); | |
} | |
/** | |
* Store a newly created resource in storage. | |
* | |
* @param \App\Http\Requests\StoreWordRequest $request | |
* @return \Illuminate\Http\Response | |
*/ | |
public function store(StoreWordRequest $request) | |
{ | |
Word::create($request->all()); | |
return redirect()->route('words.index'); | |
} | |
/** | |
* Display the specified resource. | |
* | |
* @param \App\Models\Word $word | |
* @return \Illuminate\Http\Response | |
*/ | |
public function show(Word $word) | |
{ | |
} | |
/** | |
* Show the form for editing the specified resource. | |
* | |
* @param \App\Models\Word $word | |
* @return \Illuminate\Http\Response | |
*/ | |
public function edit(Word $word) | |
{ | |
return view('words.edit', ['word'=> $word]); | |
} | |
/** | |
* Update the specified resource in storage. | |
* | |
* @param \App\Http\Requests\UpdateWordRequest $request | |
* @param \App\Models\Word $word | |
* @return \Illuminate\Http\Response | |
*/ | |
public function update(UpdateWordRequest $request, Word $word) | |
{ | |
$word->updateOrFail($request->all()); | |
return redirect()->route('words.index'); | |
} | |
/** | |
* Remove the specified resource from storage. | |
* | |
* @param \App\Models\Word $word | |
* @return \Illuminate\Http\Response | |
*/ | |
public function destroy(Word $word) | |
{ | |
// | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment