Thursday, August 4, 2016

eloquent relationships -- hasOne

1. create public function shape with hasOne relationships
class Member extends Model

    public function shape()
    {
       return $this->hasOne('App\Shape','part_id','part_id');
    }

2. Example with App\Member::with('shape')->find(1);
>>> App\Member::with('shape')->find(1);
=> App\Member {#751
     id: 1,
     part_id: "4882557",
     surname: "KRISHNAN",
     firstname: "KUMARESAN",
     email: "kumar@aeonmalaysia.com.my",
     created_at: "2016-08-04 10:19:56",
     updated_at: "2016-08-04 10:19:56",
     shape: App\Shape {#756
       id: 1,
       part_id: "4882557",
       match_score: "4.00",
       scales_num: "2.00",
       scales_cls: "22.00",
       created_at: "2016-08-04 10:20:05",
       updated_at: "2016-08-04 10:20:05",
     },
   }
>>>

Wednesday, August 3, 2016

flash implementation

1. Reference
https://github.com/laracasts/flash

2. Installation
a. Run composer require laracasts/flash
b. And then, if using Laravel 5, include the service provider within config/app.php.

'providers' => [
    Laracasts\Flash\FlashServiceProvider::class,
];

3.Usage
a. Within your controllers, before you perform a redirect...

public function store()
{
    flash('Welcome Aboard!');

    return home();
}

b. Add include flash message on view.
@include('flash::message')

<!-- This is only necessary if you do Flash::overlay('...') -->
<script src="//code.jquery.com/jquery.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<script>
    $('#flash-overlay-modal').modal();
</script>

Tuesday, August 2, 2016

To do list 3-Aug-2016

1.start on pms project
- import / export excel
- maintenance
- show chart

2. Research on high chart alignment

3. Implement Inspinia theme

Monday, August 1, 2016