public function destroy(Operation $operation) { if (is_integer($operation)) { $operation = Operation::find($operation); } $operation->delete(); Flash::success('Operation has been created Deleted!'); return Redirect::back(); }
function __construct($params) { $this->params = $params; if (!key_exists('orderBy', $this->params)) { $this->params['orderBy'] = ['date' => 'asc']; } foreach ($this->params['orderBy'] as $key => $value) { $this->operations = Operation::with('typeId')->orderBy($key, $value); } }
public function get_sharevaluationoperationform() { $toReturn = collect(); $operations = Operation::groupBy('to_share_id')->get(); for ($i = 1; $i <= 10; $i++) { $row = collect(); // date $date = '12/12/2015'; $row->put('date', $date); // vehicle $vehicle = 'vehicle 1'; $row->put('vehicle', $vehicle); // value $value = '56'; $row->put('value', $value); $toReturn->push($row); } return $toReturn; }
public function getLatestResidalValue($operationList) { //dd($operationList->type(9)->orderBy('date', 'desc')->first()->value); // 9 : Residual Value $to_share_id = $operationList->first()->to_share_id; $latestShareValue = $operationList->type(9)->orderBy('date', 'desc')->first(); if (!$latestShareValue) { //il n'y a pas d'enregistrement opertaion 'ResidualValue' dans la collection. //on va chercher la derniere qu'on a en bdd pour le tosharID return Operation::where('to_share_id', $to_share_id)->where('type_id', 9)->orderBy('date', 'desc')->first(); } return $latestShareValue; // else { // } // $baseClass = Currency::EUR; // // // if ($toShare->currency->id == $fromShare->currency->id) { // $currencyRate=1; // }else { // if ($toShare->currency->id == 2) { // $baseClass = Currency::USD; // }else{ // // } // $currencyRate = Exchange::base($baseClass) ->historical($latestShareValue->dateval) ->get()['EUR']; // } // return $currencyRate; }