vendredi 28 septembre 2018

get results from one to one relationship

**I make one to one relationship between two table. One for employees and other for their timesheet.

When i want to see the employee hours is not working ! So far i just enter hours through phpmyadmin.**

 public function up()
    {
        Schema::create('timesheets', function (Blueprint $table) {
            $table->increments('id');

            $table->integer('starz_id');
            //starz = employee. I just name it starz

            for($i=1;$i<=31;$i++){
                $table->integer('Jan'.$i)->nullable();
            }

            $table->timestamps();
        });
    }

=============================================================================

Name @for($i=1;$iJan @endfor Total @foreach($timesheet as $one) @for($i=1;$i @endfor @endforeach

=============================the resutl=================================

Name Jan1 Jan2 Jan3 Jan4 Jan5 Jan6 Jan7 Jan8 Jan9 Jan10 Jan11 Jan12 Jan13 Jan14 Total

ali 1 2 3 4 5 6 7 8 9 10 11 12 13 14

=============================================================================

Also i need to know please what is the right way to calculate the actual time. For ex: i want latter make function that caculate the actual hours working hours spent from start time (9am) and end time(6.30pm). How can i do this by laravel ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire