Skip to content

Instantly share code, notes, and snippets.

@Cerwyn
Created April 16, 2020 06:54
Show Gist options
  • Save Cerwyn/48b052bbfbf0bf8e980148d8f891616a to your computer and use it in GitHub Desktop.
Save Cerwyn/48b052bbfbf0bf8e980148d8f891616a to your computer and use it in GitHub Desktop.
One-to-many
<?php
use Illuminate\Http\Request;
Route::post('article','ArticleController@store');
Route::get('article/{article}','ArticleController@show');
Route::get('article/{article}/comments','ArticleController@show_comments');
Route::get('article/{article}/best-comment','ArticleController@show_best_comment');
Route::get('articles','ArticleController@index');
Route::delete('article/{article}','ArticleController@destroy');
Route::post('article/{article}/comment','CommentController@store');
Route::post('comment/{comment}/best-comment','CommentController@best_comment');
Route::get('comments','CommentController@index');
Route::get('comment/{comment}', 'CommentController@show');
Route::delete('comment/{comment}','CommentController@destroy');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment