示例#1
0
 public function index(RegistrationFile $RegistrationFile, $registration_id, Request $request)
 {
     $registration = Registration::findOrFail($registration_id);
     $files = $RegistrationFile->where('registration_id', $registration_id)->paginate(30);
     $required_files = config('registration.files.types');
     if ($registration->gender == 'm' || $registration->gender == 'f' && $registration->social_job_status == 'employed') {
         unset($required_files['marriage']);
     }
     if ($registration->gender == 'f' && $registration->social_status == 'married') {
         unset($required_files['job']);
     }
     $remainings = array_diff(array_keys($required_files), $files->pluck('type')->toArray());
     if ($request->has('partial')) {
         return view('registration::files._list', compact('files', 'remainings', 'registration'));
     }
     return view('registration::files.index', compact('files', 'remainings', 'registration'));
 }
 public function delete(Registration $Registration, $id)
 {
     $registration = $Registration->findOrFail($id);
     $registration->delete();
     return redirect()->route('registration.registrations.index', $registration->registration_id)->with('success', trans('registration::registrations.delete_success'));
 }