Exemplo n.º 1
0
 public function getActive()
 {
     $tip = SafetyTip::where('status', '1')->first();
     return $tip;
 }
Exemplo n.º 2
0
 /**
  * Current Parent Company Safety Tip
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function currentSafetytip()
 {
     $record = SafetyTip::where('company_id', $this->id)->where('status', '1')->first();
     return $record;
 }
Exemplo n.º 3
0
 /**
  * Migrate Tips
  */
 public function tips()
 {
     echo "<h1>Migrating Tips</h1>";
     $tips = zTip::all();
     $tips->each(function ($tip) {
         echo "<b>" . $tip->title . "</b><br>";
         $rob = User::where('username', 'boss')->first();
         $tara = User::where('username', 'anton')->first();
         switch ($tip->author) {
             case 'Robert Moerman':
                 $author = $rob->id;
                 break;
             case 'Tara Antoniolli':
                 $author = $tara->id;
                 break;
             default:
                 $author = '1';
         }
         $newTip = SafetyTip::create(array('title' => reformatOldStr($tip->title), 'body' => reformatOldStr($tip->body), 'last_published' => $tip->last_pub, 'status' => $tip->active, 'created_by' => $author, 'updated_by' => $author, 'company_id' => '3'));
     });
     echo "<h1>Completed</h1>";
 }