質問編集履歴
7
ソースコードの更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -146,7 +146,7 @@
|
|
146
146
|
|
147
147
|
{
|
148
148
|
|
149
|
-
$form = $request->file('
|
149
|
+
$form = $request->file('images[]');
|
150
150
|
|
151
151
|
$d = new \DateTime();
|
152
152
|
|
@@ -160,7 +160,7 @@
|
|
160
160
|
|
161
161
|
|
162
162
|
|
163
|
-
foreach ($data['images'] as $k => $v) {
|
163
|
+
foreach ($data['images[]'] as $k => $v) {
|
164
164
|
|
165
165
|
$filename = '';
|
166
166
|
|
@@ -246,7 +246,7 @@
|
|
246
246
|
|
247
247
|
|
248
248
|
|
249
|
-
if ($request->file('
|
249
|
+
if ($request->file('images[]')->isValid([])) {
|
250
250
|
|
251
251
|
$path = Storage::disk('s3')->putFile('/',$form,'public');
|
252
252
|
|
6
ソースコードを編集しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -146,7 +146,7 @@
|
|
146
146
|
|
147
147
|
{
|
148
148
|
|
149
|
-
$form = $request->
|
149
|
+
$form = $request->file('file');
|
150
150
|
|
151
151
|
$d = new \DateTime();
|
152
152
|
|
@@ -154,7 +154,7 @@
|
|
154
154
|
|
155
155
|
$dir = $d->format('Y/m');
|
156
156
|
|
157
|
-
$path = Storage::disk('s3')->putFile('/',$form
|
157
|
+
$path = Storage::disk('s3')->putFile('/',$form,'public');
|
158
158
|
|
159
159
|
$data = $request->except('_token');
|
160
160
|
|
@@ -164,12 +164,14 @@
|
|
164
164
|
|
165
165
|
$filename = '';
|
166
166
|
|
167
|
+
|
168
|
+
|
167
169
|
$attachments = Attachment::take(1)->orderBy('id', 'desc')->get();
|
168
170
|
|
171
|
+
|
172
|
+
|
169
173
|
foreach ($attachments as $attachment) {
|
170
174
|
|
171
|
-
|
172
|
-
|
173
175
|
$filename = $attachment->id + 1 . '_' . $v->getClientOriginalName();
|
174
176
|
|
175
177
|
}
|
@@ -246,7 +248,7 @@
|
|
246
248
|
|
247
249
|
if ($request->file('file')->isValid([])) {
|
248
250
|
|
249
|
-
$path = Storage::disk('s3')->putFile('/',$form
|
251
|
+
$path = Storage::disk('s3')->putFile('/',$form,'public');
|
250
252
|
|
251
253
|
return view('stories.index2')->with('filename', basename($path));
|
252
254
|
|
5
画像の掲載し直し
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,9 +14,15 @@
|
|
14
14
|
|
15
15
|
### 発生している問題・エラーメッセージ
|
16
16
|
|
17
|
-
|
17
|
+
アプリで画像を投稿すると以下のスクショのようなエラー画面が表示されます。
|
18
|
+
|
18
|
-
|
19
|
+
```
|
20
|
+
|
21
|
+
Call to a member function hashName() on array
|
22
|
+
|
23
|
+
```
|
24
|
+
|
19
|
-
![
|
25
|
+
![イメージ説明](a8870d45d97aa83256adf810b4ec0024.png)
|
20
26
|
|
21
27
|
|
22
28
|
|
4
補足説明の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
### 発生している問題・エラーメッセージ
|
16
16
|
|
17
|
-
アプリ
|
17
|
+
現在アプリに画像を投稿するとHerokuのPostgreSQLに保存され、投稿した画像は以下のよう表示されます。
|
18
18
|
|
19
19
|
![エラーの該当箇所](35b2fb5139345f3a1984896ae3e2302e.png)
|
20
20
|
|
3
コードの編集 web.php
test
CHANGED
File without changes
|
test
CHANGED
@@ -508,78 +508,46 @@
|
|
508
508
|
|
509
509
|
|
510
510
|
|
511
|
-
Route::
|
511
|
+
Route::group(['middleware' => 'auth'], function(){
|
512
|
-
|
512
|
+
|
513
|
-
'StoriesController@index'
|
513
|
+
Route::get('/', 'StoriesController@index');
|
514
|
-
|
515
|
-
|
514
|
+
|
516
|
-
|
517
|
-
'ProfileController@index',
|
518
|
-
|
519
|
-
'ProfileController@store'
|
520
|
-
|
521
|
-
);
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
Route::post('/', 'StoriesController@store');
|
515
|
+
Route::post('/', 'StoriesController@store');
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
516
|
+
|
530
|
-
|
531
|
-
'StoriesController@add',
|
532
|
-
|
533
|
-
'StoriesController@upload'
|
534
|
-
|
535
|
-
);
|
517
|
+
});
|
518
|
+
|
519
|
+
|
520
|
+
|
536
|
-
|
521
|
+
Route::group(['middleware' => 'auth'], function(){
|
522
|
+
|
537
|
-
|
523
|
+
Route::get('stories/create', 'StoriesController@add');
|
538
|
-
|
524
|
+
|
539
|
-
Route::post('
|
525
|
+
Route::post('stories/create', 'StoriesController@upload');
|
540
|
-
|
526
|
+
|
541
|
-
Route::get('/stories/delete', 'StoriesController@delete');
|
527
|
+
Route::get('/stories/delete', 'StoriesController@delete');
|
528
|
+
|
529
|
+
});
|
530
|
+
|
531
|
+
|
542
532
|
|
543
533
|
Route::get('/profile/delete', 'ProfileController@delete');
|
544
534
|
|
545
535
|
|
546
536
|
|
547
|
-
Route::match(['get','post','middleware'=>'auth'], 'profile/create',
|
548
|
-
|
549
|
-
'ProfileController@add',
|
550
|
-
|
551
|
-
'ProfileController@upload'
|
552
|
-
|
553
|
-
);
|
554
|
-
|
555
|
-
|
556
|
-
|
557
537
|
Route::group(['middleware' => 'auth','name'=>'profile'], function () {
|
558
538
|
|
559
539
|
Route::get('/profile/edit', 'ProfileController@edit');
|
560
540
|
|
561
541
|
Route::post('/profile/edit', 'ProfileController@update');
|
562
542
|
|
543
|
+
Route::post('/profile/create', 'ProfileController@create');
|
544
|
+
|
545
|
+
Route::get('profile/create3', 'ProfileController@index3');
|
546
|
+
|
563
547
|
});
|
564
548
|
|
565
549
|
|
566
550
|
|
567
|
-
Route::group(['middleware' => 'auth','name'=>'profile'], function () {
|
568
|
-
|
569
|
-
Route::post('/profile/create', 'ProfileController@create');
|
570
|
-
|
571
|
-
});
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
Route::group(['middleware' => 'auth'], function(){
|
576
|
-
|
577
|
-
Route::get('profile/create3', 'ProfileController@index3');
|
578
|
-
|
579
|
-
});
|
580
|
-
|
581
|
-
|
582
|
-
|
583
551
|
Route::get('/home', 'StoriesController@index')->name('home');
|
584
552
|
|
585
553
|
|
2
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -474,6 +474,126 @@
|
|
474
474
|
|
475
475
|
|
476
476
|
|
477
|
+
routes/web.php
|
478
|
+
|
479
|
+
```
|
480
|
+
|
481
|
+
<?php
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
/*
|
486
|
+
|
487
|
+
|--------------------------------------------------------------------------
|
488
|
+
|
489
|
+
| Web Routes
|
490
|
+
|
491
|
+
|--------------------------------------------------------------------------
|
492
|
+
|
493
|
+
|
|
494
|
+
|
495
|
+
| Here is where you can register web routes for your application. These
|
496
|
+
|
497
|
+
| routes are loaded by the RouteServiceProvider within a group which
|
498
|
+
|
499
|
+
| contains the "web" middleware group. Now create something great!
|
500
|
+
|
501
|
+
|
|
502
|
+
|
503
|
+
*/
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
Route::get('login');
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
Route::match(['get','post','middleweare'=>'auth'], '/',
|
512
|
+
|
513
|
+
'StoriesController@index',
|
514
|
+
|
515
|
+
'StoriesController@store',
|
516
|
+
|
517
|
+
'ProfileController@index',
|
518
|
+
|
519
|
+
'ProfileController@store'
|
520
|
+
|
521
|
+
);
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
Route::post('/', 'StoriesController@store');
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
Route::match(['get','post','middleware'=>'auth'], 'stories/create',
|
530
|
+
|
531
|
+
'StoriesController@add',
|
532
|
+
|
533
|
+
'StoriesController@upload'
|
534
|
+
|
535
|
+
);
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
Route::post('/stories/create', 'StoriesController@upload');
|
540
|
+
|
541
|
+
Route::get('/stories/delete', 'StoriesController@delete');
|
542
|
+
|
543
|
+
Route::get('/profile/delete', 'ProfileController@delete');
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
Route::match(['get','post','middleware'=>'auth'], 'profile/create',
|
548
|
+
|
549
|
+
'ProfileController@add',
|
550
|
+
|
551
|
+
'ProfileController@upload'
|
552
|
+
|
553
|
+
);
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
Route::group(['middleware' => 'auth','name'=>'profile'], function () {
|
558
|
+
|
559
|
+
Route::get('/profile/edit', 'ProfileController@edit');
|
560
|
+
|
561
|
+
Route::post('/profile/edit', 'ProfileController@update');
|
562
|
+
|
563
|
+
});
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
Route::group(['middleware' => 'auth','name'=>'profile'], function () {
|
568
|
+
|
569
|
+
Route::post('/profile/create', 'ProfileController@create');
|
570
|
+
|
571
|
+
});
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
Route::group(['middleware' => 'auth'], function(){
|
576
|
+
|
577
|
+
Route::get('profile/create3', 'ProfileController@index3');
|
578
|
+
|
579
|
+
});
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
Route::get('/home', 'StoriesController@index')->name('home');
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
Auth::routes();
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
```
|
594
|
+
|
595
|
+
|
596
|
+
|
477
597
|
初心者でまだ不慣れな部分がありますが、どうかご教授いただけると幸いです。
|
478
598
|
|
479
599
|
よろしくお願いします。
|
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -392,6 +392,88 @@
|
|
392
392
|
|
393
393
|
|
394
394
|
|
395
|
+
resources/views/stories/create2.blade.php
|
396
|
+
|
397
|
+
```
|
398
|
+
|
399
|
+
@extends('layouts.front2')
|
400
|
+
|
401
|
+
@section('title','StoryCreate')
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
@section('content')
|
406
|
+
|
407
|
+
<link href="{{ asset('/css/main22.css' )}}" rel="stylesheet">
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
<div class="poststory">
|
412
|
+
|
413
|
+
<h1>Post Story</h1>
|
414
|
+
|
415
|
+
</div>
|
416
|
+
|
417
|
+
@if ($errors->any())
|
418
|
+
|
419
|
+
<ul>
|
420
|
+
|
421
|
+
@foreach($errors->all() as $error)
|
422
|
+
|
423
|
+
<li>{{ $error }}</li>
|
424
|
+
|
425
|
+
@endforeach
|
426
|
+
|
427
|
+
</ul>
|
428
|
+
|
429
|
+
@endif
|
430
|
+
|
431
|
+
<form action="{{ url('/') }}" method="POST" enctype="multipart/form-data">
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
<div class="form">
|
436
|
+
|
437
|
+
<label for="photo" class="file">Choose Image or Video</label>
|
438
|
+
|
439
|
+
<div class="post">
|
440
|
+
|
441
|
+
<input type="file" class="here" name="images[]">
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
</div>
|
446
|
+
|
447
|
+
</div>
|
448
|
+
|
449
|
+
<br>
|
450
|
+
|
451
|
+
</div>
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
{{ csrf_field() }}
|
456
|
+
|
457
|
+
<div class="post">
|
458
|
+
|
459
|
+
<div class="btn postbtn">
|
460
|
+
|
461
|
+
<input type="submit" value="post" />
|
462
|
+
|
463
|
+
</div>
|
464
|
+
|
465
|
+
</div>
|
466
|
+
|
467
|
+
</form>
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
@endsection
|
472
|
+
|
473
|
+
```
|
474
|
+
|
475
|
+
|
476
|
+
|
395
477
|
初心者でまだ不慣れな部分がありますが、どうかご教授いただけると幸いです。
|
396
478
|
|
397
479
|
よろしくお願いします。
|