123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
-
- class Rubric extends Eloquent
- {
-
- /**
- * Searchable rules.
- *
- * @var array
- */
- protected $searchable = [
- 'columns' => [
- 'name' => 10,
- ],
- ];
-
- public function professor()
- {
- return $this->belongsTo('User')->orderBy('created_at');
- }
-
- /*
- * TODO Check if this is true later.
- */
- public function activities()
- {
- return $this->hasMany('Activity');
- }
-
- public function getCriterion($id, $criterion_id)
- {
- $rubric = Rubric::findOrFail($id);
-
- $rubric_contents = json_decode($rubric->contents);
-
- foreach ($rubric_contents as $key => $criterion)
- {
- if($criterion->id == $criterion_id)
- {
- return $criterion;
- }
- }
- }
-
- }
|