/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     /// Add sponsor
     $sponsor = new Sponsor();
     $sponsor->first_name = $request->sponsor_first_name;
     $sponsor->middle_name = $request->sponsor_middle_name;
     $sponsor->last_name = $request->sponsor_last_name;
     $sponsor->gender = $request->sponsor_gender;
     $sponsor->phone = $request->sponsor_phone;
     $sponsor->postal_address = $request->sponsor_postal_address;
     $sponsor->residence = $request->sponsor_residence;
     $sponsor->birth_date = $request->sponsor_birth_date;
     $sponsor->occupation = $request->sponsor_occupation;
     if ($sponsor->save()) {
         $application = new Application();
         $application->applicant_id = $request->applicant_id;
         $application->loan_id = $request->loan_id;
         $application->sponsor_id = $sponsor->id;
         $application->applied_amount = $request->applied_amount;
         $application->application_fee = $request->application_fee;
         $application->status = "pending";
         $application->comments = $request->comments;
         $application->collateral = $request->collateral;
         $application->collateral_value = $request->collateral_value;
         $application->created_by = 1;
         if (!$application->save()) {
             return "failed";
         } else {
             return "success";
         }
         echo json_encode($application);
     }
 }
 public function newApplication(ApplicationRequest $request, Application $application)
 {
     $application->name = $request->input('name');
     $application->businessUnit_id = $request->input('businessUnit_id');
     $application->save();
     return redirect()->back()->with('status', 'The new application has been saved successfully!');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param CreateApplicationRequest|Request $request
  * @return Response
  */
 public function store(CreateApplicationRequest $request)
 {
     $application = new Application();
     $application->fill($request->all());
     $application->user_id = Auth::user()->id;
     $application->save();
     return redirect()->back();
 }
 public function registerFund($fundId)
 {
     $application = new Application();
     $application->fund = $fundId;
     $application->status = 'applied';
     $userId = Auth::user()->id;
     $application->owner = $userId;
     $application->save();
     return redirect()->route('list_fund');
 }
 /**
  * Store a newly created Application in database.
  *
  */
 public function store(ApplicationRequest $request)
 {
     $input = $request->all();
     $application = new Application($input);
     // If the new Application is to be the default one
     if ($application->default == 1) {
         // Set all others existing as not being default in database
         $applications = Application::all();
         foreach ($applications as $app) {
             $app->default = 0;
             $app->update();
         }
     }
     $application->save();
     return redirect('application/create');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  int  $pid		profile id
  * @param  int  $jid		jobpost id
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store($pid, $jid)
 {
     $application = new Application();
     $application->profile_id = $pid;
     $application->jobpost_id = $jid;
     $application->app_date = Carbon::today();
     try {
         $application->save();
     } catch (QueryException $e) {
         $errorCode = $e->errorInfo[1];
         throw new MyQueryExceptReturn($errorCode);
     } catch (\Exception $e) {
         throw new MyExceptReturn($e->getMessage());
     }
     return redirect()->back();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param CreateApplicationRequest $request
  * @return Response
  */
 public function store(CreateApplicationRequest $request)
 {
     $application = new Application();
     $application->fill($request->all());
     $application->user_id = Auth::id();
     $application->status = 'process';
     $application->save();
     $history = new History();
     $history->status = $application->status;
     $history->message = trans('messages.application_sent_successfully');
     $history->user_id = $application->user_id;
     $history->application_id = $application->id;
     $history->save();
     $message = trans('messages.application_sent_successfully');
     Flash::info($message);
     return redirect()->route('applications.show', $application);
 }
Example #8
0
 /**
 * Display a listing of the resource.
 *
 * @return Response
 该方法的功能是向applications表里添加一条记录,并且返回一个预定已经受理的页面.
 */
 public function index($type)
 {
     $application = new Application();
     $application->studentid = Input::get('studentid');
     $application->phone = Input::get('phone');
     $application->email = Input::get('email');
     $application->type = $type;
     if ($type != 'swimming') {
         $application->date = Input::get('date');
     } else {
         $application->date = date('Y-m-d');
     }
     $application->apptime = date('Y-m-d H:i:s');
     $application->enable = 1;
     $application->notes = Input::get('notes');
     $application->begintime = Input::get('begintime');
     $application->endtime = Input::get('endtime');
     if ($application->save()) {
         return view('appsucess', ['type' => $type]);
     } else {
         return Redirect::back()->withInput()->withErrors('申请提交失败!');
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id = false)
 {
     $this->validate($request, ['a_name' => 'required|max:55']);
     if ($id) {
         $app = Application::findOrFail($id);
     } else {
         $app = new Application();
     }
     $app->name = $request->a_name;
     $app->key = $request->a_key;
     $app->private = $request->a_secret;
     $app->objects = serialize($request->objects);
     $saved = $app->save();
     if (!$id) {
         $id = $app->id;
     }
     return redirect('/apps/' . $id . '?saved=' . $saved);
 }