如何在刀片文件中获取性别(男性/女性)

时间:2019-07-10 06:13:34

标签: laravel laravel-5.8

我的laravel项目有一个表格,里面有照片和性别字段。我使用了一个复选框和一个成功存储在数据库中的价格字段,可以显示图像和价格,但是无法显示用户选择的性别。 如果有人可以帮助我! 谢谢。

我尝试了以下代码:

@foreach($file as $choice)
   {{ $choice['male'] || $choice['female'] }}
@endforeach

2 个答案:

答案 0 :(得分:1)

      {{Auth::user()->gender }}


or

@foreach($file as $choice)
      {{$choice->gender }}
    @endforeach

答案 1 :(得分:0)

如果您要存储[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] skip-name-resolve event_scheduler = on user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english skip-external-locking key_buffer = 16M max_allowed_packet = 16M thread_stack = 512K thread_cache_size = 8 myisam-recover = BACKUP max_connections = 700 #table_cache = 64 #thread_concurrency = 12 query_cache_limit = 1M query_cache_size = 50M innodb_buffer_pool_size = 16G innodb_buffer_pool_instances = 16 innodb_additional_mem_pool_size=400M innodb_log_buffer_size=80M innodb_flush_log_at_trx_commit = 0 innodb_log_file_size = 128M innodb_flush_method=O_DIRECT innodb_autoinc_lock_mode = 2 innodb_thread_concurrency = 12 sort_buffer=512M thread_concurrency=32 #record_buffer=128M query_cache_type=2 tmp_table_size=1G general_log_file = /var/log/mysql/mysql.log general_log = 0 log_slow_queries = /var/log/mysql/mysql-slow.log long_query_time = 10 = /var/log/mysql/mysql-bin.log expire_logs_days = 10 max_binlog_size = 100M [mysql] [isamchk] key_buffer = 16M [mysqldump] quick quote-names max_allowed_packet = 16M [isamchk] key_buffer = 16M 的性别信息

string

如果您要存储@foreach($file as $choice) {{$choice->gender=="male" ? "Male" : "Female }} @endforeach ,例如按性别提交的男性为0或女性为1

boolean