控制器方法
public function create(Request $request )
{
$client_id = $request->input('client_name');
//$userid = \Auth::user()->id;
$invoice_id = Invoice::create([
//'userid'=>$userid,
'clientid'=>$client_id,
])->id;
return redirect('invoice/create/'.$invoice_id);
}
查看哪里出错了
@if($invoice_product->product_qty!=null)
value="{{$invoice_product->product_qty}}"
@endif
模型
namespace App;
use Illuminate\Database\Eloquent\Model;
class InvoiceProducts extends Model
{
protected $fillable = ['invoice_id'];
}
和错误 Undefined variable: invoice_product (查看: C:\xampp\htdocs\cs\resources\views\invoice\create.blade.php)