Laravel:在控制器中成功执行功能后更新状态点

时间:2018-07-11 12:07:30

标签: laravel updates status

我有一张要检索的网址表。如果成功抓取了该行中的url,则会显示一条成功消息,并且与抓取的url相对应的点的颜色应更改(从灰色变为绿色)。

问题是我不知道如何仅对已爬网的ID进行更改。我的代码现在所做的只是在会话成功后更改所有点。如何根据抓取的ID更改颜色?有什么建议吗?

enter image description here

这是我的控制者:

\Session::flash('success', 'Scrape completed for id '.$ids.'!');
return redirect()->route('jobs', [
            'arr_ids' => $arr_ids,
        ]);

这是我的刀片桌:

<div class="table-responsive">
        <table class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th><input type="checkbox" name="myTextEditBox" value="" class="chk" id="checkAll"/></th>
                    <th>id</th>
                    <th>job_id</th>
                    <th>url</th>
                    <th>hash</th>
                    <th>created_at</th>
                    <th>updated_at</th>
                    <th>crawl-status</th>
                </tr>
            </thead>
            <tbody>
                @if(isset($urls_data))
                @foreach($urls_data as $item)
                <tr>
                    <td><input type="checkbox"  value="{{$item->id}}" class="check" /></td>
                    <td>{{$item->id}}</td>
                    <td>{{$item->job_id}}</td>
                    <td>{{$item->url}}</td>
                    <td>{{$item->hash}}</td>
                    <td>{{$item->created_at}}</td>
                    <td>{{$item->updated_at}}</td>
                    <td>
                        <span class="dot dot-secondary" value="{{$item->id}}"></span>
                        @if($message = Session::get('success'))
                           <span class="dot dot-success" ></span>
                        @endif
                    </td>
                </tr>
                @endforeach
                @endif
            </tbody>
        </table>
    </div>

0 个答案:

没有答案