Code Monkey home page Code Monkey logo

Comments (2)

matthiku avatar matthiku commented on May 23, 2024

Part 1 Implemented - Show items count

Files changed: plans.blade.php
  • Added header cell: <th class="hidden-sm-down center"># items</th>
  • added table cell: <td class="hidden-sm-down center">{{ $plan->items->count() }}</td>

TODO:

  • Show last change date of a plan and its items.

A more cpu-saving solution for the second suggestion is to always update the plan 'updated_at' field whenever an item of this plan was changed.

from cspot.

matthiku avatar matthiku commented on May 23, 2024

Part 2 implemented - Show name of last changer

Files changed:
  • AppServiceProvider.php
    Added these lines into the boot() method:
        Item::updated( function ($item) {
            // when a user changes an item, we 
            // update the 'changer' field on the parent model (plan)
            $plan = Plan::find($item->plan_id);
            $plan->update(['changer' => Auth::user()->first_name]);
        });

  • Item.php (the model)
    added this line:
    protected $touches = ['plan'];

from cspot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.