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 show($operation) { $operation = Operation::find($operation); $operation = Operation::with(['createdBy', 'currency', 'fromAccountId', 'fromShareId', 'reconciledBy', 'toAccountId', 'toShareId', 'typeId', 'updatedBy', 'validatedBy'])->where('id', $operation->id)->first(); return response(['data' => $operation, 'status' => 'success', 'message' => '']); }