是否可以使用jQuery中的text属性选择按钮?
我试着像:
$.each(data, function(index, element){
if(element.table_aval == 0)
{
var elmt = element.table_no;
$('#table button[text='+elmt+']').css('color','red');
}
});
Run Code Online (Sandbox Code Playgroud)
这可能吗?
我在模型中创建了方法:
class bill extends Model
{
public static function getTable() {
$tables = Bill::where('order_type', '0')
->where('table_no','<>','')
->groupBy('table_no')
->get();
return $tables;
} }
Run Code Online (Sandbox Code Playgroud)
在控制器中我正在访问此方法
public function bill()
{
$data = Bill::getTable();
return view('bill.bills');
}
Run Code Online (Sandbox Code Playgroud)
它Cannot make non static method Illuminate\Database\Eloquent\Model::getTable() static in class App\bill在第 17 行给出错误。我不明白出了什么问题?
我有主键和自动增量字段的表,我想要新的迁移来删除主键索引,并删除自动增量字段.我怎样才能做到这一点.
我创建了新的迁移
public function up()
{
Schema::table('tbl_message_read_state', function (Blueprint $table) {
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tbl_message_read_state', function (Blueprint $table) {
$table->dropPrimary('message_id');
$table->unsignedInteger('message_id');
});
}
Run Code Online (Sandbox Code Playgroud)
它给了我错误的命令 [Illuminate\Database\QueryException]
SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'message _id' (SQL: alter table tbl_'message_read_state' add 'message_id' int unsigned not null)
怎么了 ?????