for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Tinyissue package.
*
* (c) Mohamed Alsharaf <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tinyissue\Model\Traits\Project\Issue;
use Illuminate\Database\Eloquent;
use Illuminate\Database\Eloquent\Relations;
use Tinyissue\Model\Tag;
/**
* QueryTrait is trait class containing the database queries methods for the Project|Issue model.
* @author Mohamed Alsharaf <[email protected]>
* @method Relations\BelongsToMany tags()
trait QueryTrait
{
* Returns the status tag
* @return Tag
public function getStatusTag()
return $this->getTagOfGroup(Tag::GROUP_STATUS);
}
* Returns the type tag
public function getTypeTag()
return $this->getTagOfGroup(Tag::GROUP_TYPE);
* Returns the resolution tag
public function getResolutionTag()
return $this->getTagOfGroup(Tag::GROUP_RESOLUTION);
* Return tag by it group name.
* @param string $group
protected function getTagOfGroup($group)
return $this->tags
tags
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
->where('parent.name', $group)
->first();
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: