/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postStore(Request $request)
 {
     $input = $request->all();
     //		return ($input['Administrative']);
     DB::beginTransaction();
     $apps = Application::create($input['REGISTRANT']);
     $input['Administrative']['registrant_id'] = $apps->id;
     $input['Technical']['registrant_id'] = $apps->id;
     if ($request->hasFile("image1")) {
         $destinationPath = 'uploads/a/';
         $fileName = time() . "-" . $request->file('image1')->getClientOriginalName();
         $request->file('image1')->move($destinationPath, $fileName);
         $input['Administrative']['image'] = $fileName;
     }
     if ($request->hasFile('image2')) {
         $destinationPath = 'uploads/t/';
         $fileName = time() . "-" . $request->file('image2')->getClientOriginalName();
         $request->file('image2')->move($destinationPath, $fileName);
         $input['Technical']['image'] = $fileName;
     }
     return 1;
     Administrative::create($input['Administrative']);
     Technical::create($input['Technical']);
     DB::commit();
     return redirect()->back()->withSuccess('Application Submitted Successfully');
 }
 /**
  * Create's an application form.
  *
  * @param User $user
  * @param array $attributes
  * @return mixed
  */
 public function create(User $user, $attributes = array())
 {
     array_set($attributes, 'user_id', $user->id);
     $application = Application::create($attributes);
     Event::fire(new ApplicationSubmittedEvent($application));
     return $application;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make(Request::all(), ['name' => 'required', 'description' => 'required']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator->errors());
     } else {
         $application = Request::all();
         Application::create($application);
         return redirect('applications');
     }
 }