use Illuminate\Database\Eloquent\Model; class User extends Model { protected $table = 'users'; protected $fillable = ['name', 'email', 'password']; }
use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name="users") */ class User { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @ORM\Column(type="string", length=100) */ private $name; /** * @ORM\Column(type="string", length=100, unique=true) */ private $email; /** * @ORM\Column(type="string", length=100) */ private $password; }In this example, we use annotations to define the model schema for a user entity. The `@ORM\Entity` annotation specifies that this class is a Doctrine entity, while the `@ORM\Table` annotation specifies the name of the table. The columns are defined using `@ORM\Column` annotations with their data type and length. The `@ORM\Id` and `@ORM\GeneratedValue` annotations specify that the `$id` property is the primary key and should be generated automatically. In both examples, the code defines the structure and organization of a database table using a package or library in PHP. The first example is using the Laravel framework and its Eloquent ORM, while the second example uses Doctrine ORM.