PostsController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Post;
  4. use Carbon\Carbon;
  5. use Illuminate\Http\Request;
  6. class PostsController extends Controller
  7. {
  8. public function __construct()
  9. {
  10. $this->middleware('auth')
  11. ->except(['index', 'show']);
  12. }
  13. /**
  14. * Show the form for creating a new resource.
  15. *
  16. * @return \Illuminate\Http\Response
  17. */
  18. public function create()
  19. {
  20. return view('posts.create');
  21. }
  22. /**
  23. * Remove the specified resource from storage.
  24. *
  25. * @param int $id
  26. *
  27. * @return \Illuminate\Http\Response
  28. */
  29. public function destroy($id)
  30. {
  31. //
  32. }
  33. /**
  34. * Show the form for editing the specified resource.
  35. *
  36. * @param int $id
  37. *
  38. * @return \Illuminate\Http\Response
  39. */
  40. public function edit($id)
  41. {
  42. //
  43. }
  44. /**
  45. * Display a listing of the resource.
  46. *
  47. * @return \Illuminate\Http\Response
  48. */
  49. public function index(Request $request)
  50. {
  51. $posts = Post::latest()
  52. ->filter($request->only(['month', 'year']))
  53. ->get();
  54. return view('posts.index', compact('posts'));
  55. }
  56. public function show(Post $post)
  57. {
  58. return view('posts.show', compact('post'));
  59. }
  60. /**
  61. * Store a newly created resource in storage.
  62. *
  63. * - Create new post using the request data
  64. * - Save it to the database
  65. * - Redirect to the home page
  66. *
  67. * @param \Illuminate\Http\Request $request
  68. *
  69. * @return \Illuminate\Http\Response
  70. */
  71. public function store(Request $request)
  72. {
  73. // $post = new Post();
  74. // $post->title = $request->get('title');
  75. // $post->body = $request->get('body');
  76. // $post->save();
  77. $this->validate($request, [
  78. 'title' => 'required|min:10',
  79. 'body' => 'required',
  80. ]);
  81. auth()->user()->publish(new Post(request(['title', 'body'])));
  82. return redirect('/');
  83. }
  84. /**
  85. * Update the specified resource in storage.
  86. *
  87. * @param \Illuminate\Http\Request $request
  88. * @param int $id
  89. *
  90. * @return \Illuminate\Http\Response
  91. */
  92. public function update(Request $request, $id)
  93. {
  94. //
  95. }
  96. }
PANIC: session(release): write data/sessions/8/e/8e708347e92e3760: no space left on device

PANIC

session(release): write data/sessions/8/e/8e708347e92e3760: no space left on device
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/session@v1.0.3/session.go:204 (0xb13e07)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/context.go:80 (0x967b75)
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/inject@v0.0.0-20200308113650-138e5925c53b/inject.go:157 (0x9512ee)
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/inject@v0.0.0-20200308113650-138e5925c53b/inject.go:135 (0x951205)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/context.go:124 (0x967cc4)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/context.go:114 (0x967bf6)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/recovery.go:161 (0x15baec4)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/logger.go:40 (0x96b257)
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/inject@v0.0.0-20200308113650-138e5925c53b/inject.go:157 (0x9512ee)
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/inject@v0.0.0-20200308113650-138e5925c53b/inject.go:135 (0x951205)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/context.go:124 (0x967cc4)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/router.go:187 (0x972959)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/router.go:304 (0x973a01)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/macaron.go:218 (0x96c572)
/my/cache/.heroku/go/go1.26.3/go/src/net/http/server.go:3311 (0x85a5cd)
/my/cache/.heroku/go/go1.26.3/go/src/net/http/server.go:2073 (0x837f6f)
/my/cache/.heroku/go/go1.26.3/go/src/runtime/asm_amd64.s:1771 (0x493380)