Skip to content

Instantly share code, notes, and snippets.

@vuthaihoc
Last active April 11, 2018 04:36
Show Gist options
  • Save vuthaihoc/b94e5c3398ab9547ae51e33e10433500 to your computer and use it in GitHub Desktop.
Save vuthaihoc/b94e5c3398ab9547ae51e33e10433500 to your computer and use it in GitHub Desktop.

Các hàm public của repository

// thêm từ khóa nếu chưa có, nếu có rồi thì cập nhật trust, không cập nhật source
$keyword_repository->creat($string, $source = 'manual', $trust = 1);
// lấy ra 10 từ khóa tìm được theo từ khóa cho trước
$keyword_repository->search($query, $page = 1; $limit = 10);
// sửa từ khóa
$keyword_repository->improve($old_keyword, $new_keyword, $source = 'manual', $trust = 1);
// Lấy ra danh sách
$keyword_repository->list($where, $page = 1; $limit = 10);

$where dạng array, xem định dạng $where hỗ trợ bởi builder

ví dụ:

$where = [
    ['trust', ">", 1],
    ['trust', "<", 5]
];

Chú ý:

  • Sử dụng laravel 5.5 và PHP 7.1.x
  • Tự làm migration cho keyword
  • Có thể thêm/sửa/xóa keyword
  • Ở view không sử dụng object Keyword(nếu đặt tên model là Keyword, ý tưởng ở đây là không dùng Eloquent model trong view, tham khảo fractal).
  • Giao diện sử dụng bootstrap 4 hoặc bulma
  • Thời gian hoàn thành không quá 2 ngày.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment