在Laravel中存储每个请求

时间:2015-11-06 02:42:32

标签: php laravel laravel-5

我希望在laravel中将每个请求存储在我的商店方法中。数据来自复选框。

我收到了

array(6){   ["表2"] =>   字符串(1)" 2"   ["表6"] =>   字符串(1)" 6"   ["表8"] =>   字符串(1)" 8"   ["表10"] =>   字符串(2)" 10"   ["表11"] =>   字符串(2)" 11"   ["表14"] =>   字符串(2)" 14" }

是这样的吗?

import tkinter as tk
from tkinter import Frame, Button, Label
import time
import random

class fragal(tk.Frame):
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        self.grid()
        self.mymaster = master
        self.primes = []
        self.cntr1a = 0
        self.cntr1b = 0
        self.cntr2a = 0
        self.cntr2b = 0
        self.count = IntVar()
        self.count.set(0)
        self.time_remaining = IntVar()
        self.time_remaining.set(0)
        self.gamearray = []
        self.equation = StringVar()
        self.equation.set("")

请注意,我得到了:

public function store( EntryFormRequest $request )
{
 $requetes = $request->except('_token');
 var_dump($requetes);

 foreach ($requetes as $requete) {

     $entry= new Entry;
     $entry->table_id   = $request->input($requete->id);
     $entry->save();

 }
}

1 个答案:

答案 0 :(得分:1)

试试这个:

foreach ($requetes as $key => $requete) {
 $entry= new Entry;
 $entry->table_id   = $requete->id;
 $entry->save();
}