Example #1
0
 public function execute()
 {
     \DB::transaction(function () {
         $outlet = $this->factory->create($this->data);
         $owner = User::whereTitle('owner')->whereCompanyId($this->auth->getCompanyId())->first();
         $owner->outlets()->attach($outlet->id);
     });
 }
Example #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     foreach ($this->employeeAbilities() as $doThis) {
         \Bouncer::allow('employee')->to($doThis);
     }
     foreach ($this->OwnerAbilities() as $doThis) {
         \Bouncer::allow('owner')->to($doThis);
     }
     foreach ($this->adminAbilities() as $doThis) {
         \Bouncer::allow('admin')->to($doThis);
     }
     $owners = User::whereTitle('owner')->get();
     foreach ($owners as $owner) {
         $owner->assign('owner');
     }
     User::all()->each(function ($employee) {
         $employee->assign('employee');
     });
 }