Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

28 lignes
523B

  1. <?php
  2. namespace App\Models;
  3. use Framework\Database\Model;
  4. class Product extends Model
  5. {
  6. protected string $table = 'products';
  7. public function getNameAttribute($value): string
  8. {
  9. return ucwords($value);
  10. }
  11. public function setDescriptionAttribute(string $value)
  12. {
  13. $limit = 50;
  14. $ending = '...';
  15. if (mb_strwidth($value, 'UTF-8') <= $limit) {
  16. return $value;
  17. }
  18. return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')) . $ending;
  19. }
  20. }

Powered by TurnKey Linux.