UsefulCount.php 466 B

123456789101112131415161718192021
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class UsefulCount extends Model
  5. {
  6. protected $table = 'useful_count';
  7. protected $primaryKey = 'id';
  8. const CREATED_AT = 'creation_date';
  9. public static function getInfo(int $problem_id)
  10. {
  11. return self::query()->where('problem_id', $problem_id)->first();
  12. }
  13. public static function insertData(array $data)
  14. {
  15. return self::query()->insert($data);
  16. }
  17. }