-
app/Models/Transactions/Transaction.php
Open in GitHubuse Illuminate\Database\Eloquent\Model; class Transaction extends Model { // protected $appends = ['is_split']; // public function splits() { return $this->hasMany('App\Models\Transactions\Split', 'transaction_id', 'id'); } public function getIsSplitAttribute() { return $this->splits()->count() > 0 ? true : false; } // }
-
resources/js/Pages/Transactions/Show/components/Breakdown.vue
Open in GitHub// ... <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"> <tags v-if="!transaction.is_split" :unique="'transaction-tags'" :existing="transaction.tags" /> <div class="flex flex-col" v-if="transaction.is_split"> <div class="mb-1"> <span v-for="(tag, key) in splitTags" v-bind:key="'transaction-split-'+key" class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium mr-1" v-bind:class="[ 'bg-'+tag.color+'-100', 'text-'+tag.color+'-800' ]"> {{ tag.name }} </span> </div> <span class="text-xs italic">Transaction is split, tags are from splits.</span> </div> </dd> // ...