Update Submissions and add fields
This commit is contained in:
@@ -10,14 +10,16 @@ use App\Jobs\DeleteXenForoCommentsThread;
|
||||
use App\Models\Author;
|
||||
use App\Models\Entry;
|
||||
use App\Models\EntryFile;
|
||||
use App\Models\EntryGallery;
|
||||
use App\Models\Gallery;
|
||||
use App\Models\EntryHash;
|
||||
use App\Models\Game;
|
||||
use App\Models\Genre;
|
||||
use App\Models\Language;
|
||||
use App\Models\Level;
|
||||
use App\Models\Modification;
|
||||
use App\Models\Platform;
|
||||
use App\Models\Status;
|
||||
use App\Models\System;
|
||||
use App\Services\SubmissionsService;
|
||||
use App\Services\XenforoApiService;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -39,19 +41,27 @@ class SubmissionController extends Controller
|
||||
'words' => FormHelpers::getEntryFormWords($section),
|
||||
'isEdit' => false,
|
||||
'oldModifications' => old( 'modifications', [] ),
|
||||
'oldSystems' => old( 'systems', [] ),
|
||||
'oldLanguages' => old( 'languages', [] ),
|
||||
'oldCategories' => old( 'categories', [] ),
|
||||
'oldFilesArray' => $this->services->prepareOldFiles( null )
|
||||
];
|
||||
|
||||
if( $data['words'] === [] )
|
||||
abort(500);
|
||||
|
||||
if( section_must_be( 'romhacks', $section ) ){
|
||||
if( section_must_be( ['romhacks', 'lua-scripts'], $section ) ){
|
||||
$data['modifications'] = Modification::orderBy('name')->get();
|
||||
}
|
||||
if( section_must_be( [ 'romhacks', 'translations', 'homebrew' ], $section ) ){
|
||||
if( section_must_be( [ 'romhacks', 'translations', 'homebrew', 'lua-scripts' ], $section ) ){
|
||||
$data['statuses'] = Status::orderBy('id')->get();
|
||||
}
|
||||
if( section_must_be( 'utilities' , $section ) ){
|
||||
$data['systems'] = System::orderBy('name')->get();
|
||||
}
|
||||
if( section_must_be( [ 'utilities', 'documents' ], $section ) ) {
|
||||
$data['levels'] = Level::orderBy('id')->get();
|
||||
}
|
||||
|
||||
return view('submissions.create', $data);
|
||||
}
|
||||
@@ -68,19 +78,27 @@ class SubmissionController extends Controller
|
||||
'words' => FormHelpers::getEntryFormWords($section),
|
||||
'isEdit' => true,
|
||||
'oldModifications' => old('modifications', $entry->modifications->pluck('id')->toArray() ?? [] ),
|
||||
'oldSystems' => old( 'systems', $entry->systems->pluck('id')->toArray() ?? [] ),
|
||||
'oldLanguages' => old('languages', $entry->languages->pluck('id')->toArray() ?? [] ),
|
||||
'oldCategories' => old('categories', $entry->categories->pluck('id')->toArray() ?? [] ),
|
||||
'oldFilesArray' => $this->services->prepareOldFiles( $entry )
|
||||
];
|
||||
|
||||
if( $data['words'] === [] )
|
||||
abort(500);
|
||||
|
||||
if( section_must_be( 'romhacks', $section ) ){
|
||||
if( section_must_be( [ 'romhacks', 'lua-scripts' ], $section ) ){
|
||||
$data['modifications'] = Modification::orderBy('name')->get();
|
||||
}
|
||||
if( section_must_be( [ 'romhacks', 'translations' ], $section ) ){
|
||||
if( section_must_be( [ 'romhacks', 'translations', 'homebrew', 'lua-scripts' ], $section ) ){
|
||||
$data['statuses'] = Status::orderBy('id')->get();
|
||||
}
|
||||
if( section_must_be( 'utilities' , $section ) ){
|
||||
$data['systems'] = System::orderBy('name')->get();
|
||||
}
|
||||
if( section_must_be( [ 'utilities', 'documents' ], $section ) ) {
|
||||
$data['levels'] = Level::orderBy('id')->get();
|
||||
}
|
||||
|
||||
return view('submissions.edit', $data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user