예제 #1
0
 public function delete(Request $request)
 {
     $outcome = Outcome::find($request->input('id'));
     $outcome->delete();
     foreach ($outcome->outcomes as $out) {
         $out->delete();
         foreach ($out->todos as $todo) {
             $todo->delete();
         }
     }
     foreach ($outcome->todos as $todo) {
         $todo->delete();
     }
     return $request;
 }
예제 #2
0
 /**
  * Query outcomes related to account
  * @return \Illuminate\Database\Eloquent\Builder Query
  */
 public function outcomes()
 {
     return Outcome::whereIn('envelope_id', function (QueryBuilder $query) {
         $query->select('id')->from('envelopes')->where('account_id', $this->id);
     })->orderBy('outcomes.date');
 }
 /**
  * Run the database seed for envelope "DU Droit des étrangers" on account "Compte joint".
  *
  * @return void
  */
 public function runEnvelope10()
 {
     Outcome::create(['envelope_id' => 10, 'name' => "Train", 'amount' => 25, 'date' => Carbon::create(2015, 8, 6, 0)]);
     Outcome::create(['envelope_id' => 10, 'name' => "Train", 'amount' => 25, 'date' => Carbon::create(2015, 8, 10, 0)]);
     Outcome::create(['envelope_id' => 10, 'name' => "Train", 'amount' => 25, 'date' => Carbon::create(2015, 8, 14, 0)]);
     Outcome::create(['envelope_id' => 10, 'name' => "Train", 'amount' => 25, 'date' => Carbon::create(2015, 8, 17, 0)]);
     Outcome::create(['envelope_id' => 10, 'name' => "Train", 'amount' => 25, 'date' => Carbon::create(2015, 8, 20, 0)]);
     Outcome::create(['envelope_id' => 10, 'name' => "Train", 'amount' => 25, 'date' => Carbon::create(2015, 8, 24, 0)]);
     Outcome::create(['envelope_id' => 10, 'name' => "Train", 'amount' => 25, 'date' => Carbon::create(2015, 8, 27, 0)]);
     Outcome::create(['envelope_id' => 10, 'name' => "Train", 'amount' => 25, 'date' => Carbon::create(2015, 8, 31, 0)]);
 }
 public function destroy($id)
 {
     Outcome::destroy($id);
 }
예제 #5
0
 public function get(Request $request)
 {
     $outcome = App\Outcome::find($request->input('id'));
     return $outcomes->todos;
 }
 /**
  * Run the database seed for envelope "Sorties" on account "Vacances en Écosse".
  *
  * @return void
  */
 public function runEnvelope14()
 {
     Outcome::create(['envelope_id' => 14, 'name' => "Museum of Childhood", 'amount' => 15, 'date' => Carbon::create(2015, 10, 1, 0)]);
     Outcome::create(['envelope_id' => 14, 'name' => "Bateau Loch Lomond", 'amount' => 30, 'date' => Carbon::create(2015, 10, 1, 0)]);
     Outcome::create(['envelope_id' => 14, 'name' => "Château d'Inveraray", 'amount' => 20, 'date' => Carbon::create(2015, 10, 1, 0)]);
 }
예제 #7
0
 /**
  * Save request inputs into account's outcome
  * @param  \Illuminate\Http\Request $request
  * @param  \App\Operation|null $operation Operation
  * @return void
  */
 public function saveOutcome(Request $request, $operation)
 {
     if (is_null($operation)) {
         $operation = new Outcome();
     }
     $operation->fill(['envelope_id' => $request->get('envelope_id'), 'name' => $request->get('name'), 'amount' => $request->get('amount'), 'date' => Carbon::createFromFormat('d/m/Y', $request->get('date'))->startOfDay()])->save();
 }