public function run() { $kinds = [["symbol" => "HS", "description" => "Hình sự"], ["symbol" => "MT", "description" => "Ma túy"], ["symbol" => "PĐ", "description" => "Phản động"]]; foreach ($kinds as $kind) { Kind::create($kind); } }
/** * Show the form for creating a new lead * * @return \Illuminate\Http\Response */ public function create() { $business_lines = BusinessLine::all(); $lead_sources = LeadSource::all(); $lead_statuses = LeadStatus::all(); $kinds = Kind::all(); return view('leads.create', compact('business_lines', 'lead_sources', 'lead_statuses', 'kinds')); }
public function createStdObject() { $kinds = Kind::all(); $categories = Category::all(); $result = []; foreach ($kinds as $key => $kind) { $obj = new \stdClass(); $symbol = []; foreach ($categories as $key => $category) { $j = new \stdClass(); $j->symbol = $category->symbol; $j->total = 0; array_push($symbol, $j); } $obj->description = $kind->description; $obj->symbol = $symbol; $obj->total = 0; array_push($result, $obj); } return $result; }
/** * Show the form for editing an entity * * @param int $id * @return Response */ public function edit($id) { $entity = Entity::findOrFail($id); $kinds = Kind::all(); return view('entities.edit', compact('entity', 'kinds')); }