123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
-
- class Rubric extends Eloquent
- {
-
- /**
- * Searchable rules.
- *
- * @var array
- */
- protected $searchable = [
- 'columns' => [
- 'name' => 10,
- ],
- ];
-
- public function professor()
- {
- return $this->belongsTo('User')->orderBy('created_at');
- }
-
- public function activities()
- {
- return $this->belongsToMany('Activity', 'rubric_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;
- }
- }
- }
- }
|