示例#1
0
 /**
  * Given the test category name we return the test category ID
  *
  * @param $testcategory - the name of the test category
  */
 public static function getTestCatIdByName($testCategory)
 {
     try {
         $testCatId = TestCategory::where('name', 'like', $testCategory)->firstOrFail();
         return $testCatId->id;
     } catch (ModelNotFoundException $e) {
         Log::error("The test category ` {$testCategory} ` does not exist:  " . $e->getMessage());
         //TODO: send email?
         return null;
     }
 }
示例#2
0
 /**
  * @return \Illuminate\Routing\Route|null|string
  */
 public function ingnoreId()
 {
     $id = $this->route('testcategory');
     $name = $this->input('name');
     return TestCategory::where(compact('id', 'name'))->exists() ? $id : '';
 }