| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public static function getIdByTitle($title) |
||
| 34 | { |
||
| 35 | $id = null; |
||
| 36 | if (empty($title)) { |
||
| 37 | return $id; |
||
| 38 | } |
||
| 39 | $place = self::where('title', $title)->first(); |
||
| 40 | if ($place !== null) { |
||
| 41 | $id = $place->id; |
||
| 42 | } else { |
||
| 43 | $place = self::create(compact('title')); |
||
| 44 | $id = $place->id; |
||
| 45 | } |
||
| 46 | |||
| 47 | return $id; |
||
| 48 | } |
||
| 50 |