public function post_index() { $buscado = Input::get('buscar'); $this->data[$this->views] = Material::where('nombre', 'LIKE', $buscado . '%')->or_where('clave', 'LIKE', $buscado . '%')->order_by('id', 'asc')->paginate(PER_PAGE_MEDIUM); return View::make('admin.' . $this->views . '.index', $this->data); }
$foods = Food::where('category_id', $args['id'])->select('food_id', 'name', 'description')->take(6)->offset($args['page'] * 6)->orderBy('food_id', 'DESC')->get(); return $response->getBody()->write(json_encode($foods) . ' '); })->setName('user_foods'); })->add($UserToken); $app->group('/food', function () { // arama $this->post('/search', function ($request, $response, $args) { $searchData = json_decode($request->getBody()); $cleanStr = preg_replace('/[ ]*,[ ]*/i', ',', $searchData->search); $materials = explode(",", $cleanStr); $materials = array_filter($materials); if (count($materials) > 20) { return $response->write('{"msg":"çok fazla malzeme bilgisi var"}'); } foreach ($materials as $material) { $oldMaterial = Material::where('name', $material)->get(); if (!$oldMaterial->isEmpty()) { $oldMaterial = $oldMaterial->first(); $oldMaterial->count += 1; $oldMaterial->last_update_date = date("YmdHi"); $oldMaterial->save(); } else { $newMaterial = new Material(); $newMaterial->name = $material; $newMaterial->create_date = date("YmdHi"); $newMaterial->last_update_date = date("YmdHi"); $newMaterial->save(); } } $sqlStr = "*" . implode("* *", $materials) . "*"; // giri *domates* *tavuk* *malzeme* şeklindedir
public function deleteMaterial($id) { DB::table('materialcategories')->where('fk_materialsid', '=', $id)->delete(); Accessorie::where('fk_mastermaterial', '=', $id)->orwhere('fk_slavematerial', '=', $id)->delete(); Material::where('id', '=', $id)->delete(); }