Ejemplo n.º 1
0
 public function run()
 {
     DB::table('conditions')->delete();
     //ALL
     Condition::create(['loantype_id' => 1, 'condition' => 'Agricultural Security Agreement on Crops and Equipment']);
     Condition::create(['loantype_id' => 1, 'condition' => 'Assignment of Crop Insurance']);
     Condition::create(['loantype_id' => 1, 'condition' => 'Assignment of Rebates']);
     Condition::create(['loantype_id' => 1, 'condition' => 'Assignment of FSA Direct and LDP Payment']);
     Condition::create(['loantype_id' => 1, 'condition' => 'Personal Guarantee']);
     //AGI
     Condition::create(['loantype_id' => 2, 'condition' => 'Agricultural Security Agreement on Crops and Equipment']);
     Condition::create(['loantype_id' => 2, 'condition' => 'Assignment of Crop Insurance']);
     Condition::create(['loantype_id' => 2, 'condition' => 'Assignment of Rebates']);
     Condition::create(['loantype_id' => 2, 'condition' => 'Assignment of FSA Direct and LDP Payment']);
     Condition::create(['loantype_id' => 2, 'condition' => 'Approval by Distributor']);
     Condition::create(['loantype_id' => 2, 'condition' => 'Personal Guarantee']);
     //AGP
     Condition::create(['loantype_id' => 3, 'condition' => 'Agricultural Security Agreement on Crops and Equipment']);
     Condition::create(['loantype_id' => 3, 'condition' => 'Assignment of Crop Insurance']);
     Condition::create(['loantype_id' => 3, 'condition' => 'Assignment of Rebates']);
     Condition::create(['loantype_id' => 3, 'condition' => 'Assignment of FSA Direct and LDP Payment']);
     Condition::create(['loantype_id' => 3, 'condition' => 'Personal Guarantee']);
     //AGF
     Condition::create(['loantype_id' => 4, 'condition' => 'Agricultural Security Agreement on Crops and Equipment']);
     Condition::create(['loantype_id' => 4, 'condition' => 'Personal Guarantee']);
     //VST
     Condition::create(['loantype_id' => 5, 'condition' => 'Approval by Distributor']);
     Condition::create(['loantype_id' => 5, 'condition' => 'Personal Guarantee']);
     //CAP
     Condition::create(['loantype_id' => 6, 'condition' => 'Agricultural Security Agreement on Crops and Equipment']);
     Condition::create(['loantype_id' => 6, 'condition' => 'Personal Guarantee']);
     //STO
     Condition::create(['loantype_id' => 7, 'condition' => 'Grain Storage Agreement']);
 }
Ejemplo n.º 2
0
 public function handle(LoanWasCreated $event)
 {
     $cons = Condition::where('loantype_id', $event->loan->loan_type_id)->get();
     $globs = Globvar::all();
     $g = $globs[0];
     foreach ($cons as $con) {
         Loancondition::create(['loan_id' => $event->loan->id, 'crop_year' => $g->crop_year, 'category' => 'loan', 'condition' => $con->condition]);
     }
 }
Ejemplo n.º 3
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Condition::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
 public function destroy($condition_id)
 {
     $condition = Condition::findOrFail($condition_id);
     if (Gate::denies('delete-condition', $condition)) {
         abort(403);
     }
     $offer_id = $condition->offer->id;
     $condition->delete();
     // Flash message
     Session::flash('message', 'You have deleted a condition from the offer.');
     Session::flash('message-type', 'success');
     // Redirect
     return redirect(url('/offer/' . $offer_id . '#conditions'));
 }
 public function remove_award($offer_id)
 {
     $offer = Offer::findOrFail($offer_id);
     if (Gate::denies('remove-award', $offer)) {
         abort(403);
     }
     // Update Offer status
     $offer->status = 0;
     $offer->save();
     // Update Violation status
     $violation = $offer->violation;
     $violation->status = 0;
     $violation->save();
     // Delete all conditions asociated with this offer
     Condition::where('offer_id', $offer_id)->delete();
     // Send email
     $email = $offer->author->email;
     $to = $offer->author->username;
     $customer_name = $offer->violation->author->username;
     $address = $violation_name = $violation->address1 . ', ' . $violation->city . ' (' . $violation->getOriginal('state') . ') ' . $violation->zip;
     $offer_id = $offer->id;
     $data = compact('to', 'customer_name', 'address', 'offer_id');
     Mail::send('emails.revokeofferaward', $data, function ($message) use($email) {
         $message->subject('Your offer is no longer awarded!');
         $message->to($email);
     });
     // Flash message
     Session::flash('message', 'You have revoked the award to this offer.');
     Session::flash('message-type', 'success');
     // Redirect
     return redirect()->action('OfferController@show', [$offer_id]);
 }
Ejemplo n.º 6
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $project = Project::findOrFail($id);
     $bookmark_id = "none";
     if (Auth::check()) {
         $id_user = Auth::user()->id;
         $results = DB::select('select id from bookmarks where project_id = ? AND user_id = ?', [$project->id, $id_user]);
         if ($results) {
             $bookmark_id = $results;
         }
     }
     $data = ['pr' => Project::findOrFail($id), 'image' => $project->image()->get(), 'bookmark' => $bookmark_id, 'comments' => Comment::where('project_id', '=', $id)->get(), 'conditions' => Condition::findOrFail($id)];
     // dd(Auth::user()->avatar);
     return view('project.info')->with($data);
 }
Ejemplo n.º 7
0
 /**
  * Update the specified resource in storage.
  *
  * @param $id
  * @param LibraryRequest $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function update($id, LibraryRequest $request)
 {
     $books = Book::findOrFail($id);
     $bindings = Binding::with('id');
     $categories = Categories::with('id');
     $conditions = Condition::with('id');
     $editions = Edition::with('id');
     $publishers = Publisher::with('id');
     $rarities = Rarity::with('id');
     $signatures = Signature::with('id');
     // Availability option switch (on = 1; off = 0)
     $available = Input::all();
     // Special Collection option switch (on = 1; off = 0)
     $special_collection = Input::all();
     // Handle With Care option switch (on = 1; off = 0)
     $handle_with_care = Input::all();
     $books->update($request->all());
     Auth::user()->books()->save($books, $bindings, $categories, $conditions, $editions, $publishers, $rarities, $signatures, $available, $special_collection, $handle_with_care);
     return redirect('admin/library');
 }