Ejemplo n.º 1
0
@endsection

@section('content')
    
    @if($project)
        @include('projects.show.header')
        <div class="row container-fluid project-work main-content">
            @if(App\Project::findOrFail($project->id)->getActiveSprint())
                @if(count($issues) > 0)
                    <?php 
$issueStatuses = App\IssueStatus::getBySortOrder();
?>
                    @foreach($issueStatuses as $issueStatus)
                        <div class="col-sm-4">
                            <?php 
$list = App\Utils::getIssuesInSprintByIssueStatus($issueStatus->machine_name, $sprint->id);
?>
                            <h3 data-status-heading="{{$issueStatus->machine_name}}">{{$issueStatus->label}}
                                <span class="grey issue-count">({{$list->count()}})</span>
                            </h3>
                            @include('projects.show.issues-list')
                        </div>
                    @endforeach
                @endif
            @else
                <p>No active sprint is set for this project.</p>
            @endif
            @else
                <h3>No issues found</h3>
                <p><a href="/issues/create">Create a new issue</a></p>
            @endif
// -------------
//
// This example shows that Collection constrains checks
// if array field fulfill our constraints or
// if some array fields are missing or
// if there are some extra fields in validated array
echo "Example no. 1: \n";
$inputData = ['name' => '', 'age' => '', 'isActive' => '', 'createdAt' => ''];
$violations = $validator->validate($inputData, new Collection(['name' => new NotBlank(), 'email' => new Email(['groups' => 'test'])]), ['test']);
App\Utils::printViolations($violations);
// Example no. 2
// -------------
//
// In this example, we can see that there are some options we can
// use to allow extra fields or ignore missing fields.
//
// If we want to use these options we have to put our constraints under
// the 'fields' key in options argument of Collection object.
echo "Example no. 2: \n";
$inputData = ['name' => 'Petr', 'age' => '', 'isActive' => '', 'createdAt' => ''];
$violations = $validator->validate($inputData, new Collection(['fields' => ['name' => new NotBlank(), 'email' => new Email()], 'allowExtraFields' => true, 'allowMissingFields' => true]));
App\Utils::printViolations($violations);
// Example no. 3
// -------------
//
// In this example we can see more useful constraints. You can play with it
echo "Example no. 3: \n";
$inputData = ['name' => 'Jan', 'age' => 20, 'card' => '5111111111111111', 'note' => '', 'email' => '*****@*****.**', 'gender' => 'male', 'isActive' => true, 'createdAt' => new \DateTime()];
$violations = $validator->validate($inputData, new Collection(['name' => [new NotBlank()], 'age' => [new NotBlank(), new Type(['type' => 'integer']), new Range(['min' => 18, 'max' => 80, 'minMessage' => "You must be at least {{ limit }} years old to enter.", 'maxMessage' => "You are too old. Entering is not safe for you. Access is allowed only for persons younger than {{ limit }}"])], 'card' => [new NotBlank(), new CardScheme(['schemes' => ['MASTERCARD', 'VISA']])], 'note' => [new Length(['min' => 20, 'minMessage' => "Your note must have at least {{ limit }} characters"])], 'email' => [new NotBlank(), new Email()], 'gender' => [new Choice(['choices' => ['male', 'female']])], 'isActive' => [new NotBlank(), new Type(['type' => 'bool'])], 'createdAt' => [new NotBlank(), new DateTime()]]));
App\Utils::printViolations($violations);