小编Vin*_*ius的帖子

如何从一行获取数据并转移到模态?Laravel 5.4

我有一个表格,其中包含我的数据库中的listo产品,其中包含ID,名称,描述以及其他数据类型.我创建了一个按钮,可以调用模态来显示有关产品的更多详细信息,但是模式始终显示表中第一个产品的详细信息,而不是与其相关的ID.

我的桌子:

在此输入图像描述

我的表格代码:

    <table class="table table-striped table-bordered" id="table1" class="table table-bordered">
                                <thread>
                                    <th><center>Imagem</center></th>
                                    <th>SKU</th>
                                    <th><center>Produto</center></th>
                                    <th>Custo</th>
                                    <th>Preço</th>
                                    <th>Atualização</th>
                                    <th>Status</th>
                                    <th>Estoque</th>
                                    <th>Distruibuidor</th>
                                    <th>Categoria</th>
                                    <th id="acoes">Ações</th>
                                </thread>
                                @foreach($product as $prod)
                                    <thread>
                                        <tbody>
                                        <td><img src="{{$prod->image->erp_image}}" style="width: 50px; height: 50px;" alt="" id="ProdImage"></td>
                                        <td>{{$prod->erp_model}}</td>
                                        <td>{{$prod->description->erp_name}}</td>
                                        <td>R$ {{$prod->erp_cost}}</td>
                                        <td>R$ {{$prod->erp_price}}</td>
                                        <td>{{ $prod->erp_modifieddate}}</td>
                                        <td style="max-width: 45px">
                                            @if($prod->status == 1)
                                                <span class="label label-success">Ativo</span>
                                            @else
                                                <span class="label label-danger">Inativo</span>
                                            @endif
                                        </td>
                                        <td>{{ $prod->erp_quantity}}</td>
                                        <td>@if($prod->erp_distributor == 'A')
                                                <span class="label label-default">Aldo</span>
                                            @elseif($prod->erp_distributor == 'AN')
                                                <span class="label label-default">All Nations</span>
                                            @elseif($prod->erp_distributor == 'H')
                                                <span class="label …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-5

2
推荐指数
1
解决办法
2674
查看次数

如何在Laravel中设置全局变量?

我正在开发一个应用程序,我想用CURL获取一些数据,我正在使用Guzzle来获取这些信息.在每个请求中我都需要放入参数api_token.我没有请求的问题,但我需要创建一个全局变量或配置这个值.我的问题是:我如何定义这些值,并在我提出的每个请求中使用它们之后?

    $response = $client->request('POST', 'https://api.iugu.com/v1/payment_token?api_token=API_TOKEN', [
      'json' => [
          'account_id' => $account_id,
          'method' => $method,
          'test' => true,
          'data' => [[
            'number' => $number,
            'verification_value' => $verification_value,
            'first_name' => $first_name,
            'last_name' => $last_name,
            'month' => $month,
            'year' => $year
          ]]
      ]
    ]);
Run Code Online (Sandbox Code Playgroud)

当我用纯PHP创建项目时.我用这个:

require 'environment.php';

$config = array();

if(ENVIRONMENT == 'development') {
    define("BASE_URL", "http://localhost/plans/");
    define("ACCOUNT_ID", "SECRET");
    define("ACCESS_TOKEN", "SECRET");
    $config['db_name'] = 'SECRET';
    $config['host'] = 'localhost';
    $config['db_user'] = 'root';
    $config['db_password'] = 'xrb55sjd';
} else {
    define("BASE_URL", "http://www.blablabla/test");
    define("ACCOUNT_ID", "SECRET");
    define("ACCESS_TOKEN", …
Run Code Online (Sandbox Code Playgroud)

php global-variables laravel

2
推荐指数
1
解决办法
1081
查看次数

标签 统计

laravel ×2

php ×2

global-variables ×1

laravel-5 ×1