PostsController.php 2.5 KB

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

PANIC

session(release): write data/sessions/0/5/058b0477d6600e29: 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)