public function removeById(Uuid $id)
 {
     foreach ($this->users as $i => $user) {
         /** @var \Notes\Domain\Entity\User $user*/
         if ($user->getId()->__toString() === $id->__toString()) {
             unset($this->users[$i]);
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 public function testUuidExpectedSeed()
 {
     $faker = new Generator();
     $faker->seed(123);
     $this->assertEquals("8e2e0c84-50dd-367c-9e66-f3ab455c78d6", BaseProvider::uuid());
     $this->assertEquals("073eb60a-902c-30ab-93d0-a94db371f6c8", BaseProvider::uuid());
 }
 protected static function boot()
 {
     parent::boot();
     static::creating(function (RegistrationApplication $model) {
         $model->setIncrementing(false);
         $model->setAttribute($model->getKeyName(), Uuid::uuid());
     });
     static::creating(function (RegistrationApplication $model) {
         $model->generateTicket();
     });
 }
Ejemplo n.º 4
0
 /**
  * Insert new family
  *
  * @return mixed
  */
 public function getNewSet()
 {
     $this->setCol = Uuid::uuid();
     $this->save();
     return $this->id;
 }
Ejemplo n.º 5
0
 public static function getUUID()
 {
     return str_replace('-', '', Uuid::uuid());
 }
Ejemplo n.º 6
0
 public function saveProspectus(CreateProspectusRequest $req)
 {
     $guid = Uuid::uuid();
     $prospectus = new Prospectus();
     $prospectus->prospectus_guid = $guid;
     $prospectus->catalog_no = $req->catalog_no;
     $prospectus->curriculum = $req->curriculum;
     $prospectus->year = $req->year;
     $prospectus->semester = $req->semester;
     $prospectus->type = $req->type;
     $prospectus->save();
     return Prospectus::with('getCatalog')->where('prospectus_guid', $guid)->get()->first();
 }
Ejemplo n.º 7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->insert(['user_guid' => Uuid::uuid(), 'firstname' => 'Axel', 'middlename' => 'Cudal', 'lastname' => 'lastname', 'username' => 'rozxel21', 'email' => '*****@*****.**', 'password' => bcrypt('saitama'), 'credential' => 'administrator', 'created_at' => date('Y-m-d H:i:s')]);
 }
Ejemplo n.º 8
0
/**
 * Generates a unique UUID string.
 *
 * @return string
 */
function uuid()
{
    return \Faker\Provider\Uuid::uuid();
}
 public function doUploadPhoto(Server $server, Request $request, $id)
 {
     /* @var Project $project */
     $project = Project::find($id);
     if (!$project) {
         return redirect('backend/admin/project');
     }
     $file = $request->files->get("photo")["file"];
     $photoInput = $request->get('photo');
     if ($file->isValid()) {
         $originalExt = $file->getClientOriginalExtension();
         $newFileName = Uuid::uuid() . "." . $originalExt;
         $destinationPath = storage_path("app/project/{$id}/photo");
         $file->move($destinationPath, $newFileName);
         $photo = new Photo();
         $photo->description = $photoInput['description'];
         $photo->filename = $newFileName;
         $server->makeImage("project/{$id}/photo/{$newFileName}", ['w' => 300, 'h' => 300]);
         $project->photos()->save($photo);
     }
     return redirect("/backend/admin/project/{$id}/edit/third");
 }
 public function removeById(Uuid $id)
 {
     $results = [];
     foreach ($this->users as $i => $user) {
         if ($user->getId()->__toString() === $id->__toString()) {
             unset($this->users[$i]);
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 11
0
 /**
  * Adds a suggested website
  *
  * @param $data
  * @return Website
  * @throws UnprocessableEntityException
  */
 public function suggest($data)
 {
     $wn = Uuid::uuid();
     $this->urlIsRequired($data);
     $website = Website::register(new Name($wn), new URL($data['url']));
     $website->setSuggestion(true);
     $this->setDescription($data, $website);
     $this->websitesRepository->add($website);
     return $website;
 }
Ejemplo n.º 12
0
 /**
  * @param \Notes\Domain\ValueObject\Uuid $id
  * @param string $newUsername
  * @return bool
  */
 public function modifyById(Uuid $id, $newUsername)
 {
     // TODO: Implement modifyById() method.
     return $this->adapter->update("users", [$newUsername, $id->__toString()]);
 }