/**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($course_url, $stage_url)
 {
     $curso = Course::where('url', $course_url)->first();
     $etapa = Stage::where('url', $stage_url)->where('course_id', $curso->id)->first();
     $tiposItem = ItemType::all()->pluck('name', 'id');
     return view('pages.items.create', ['curso' => $curso, 'etapa' => $etapa, 'tiposItem' => $tiposItem]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($course_url, $stage_url, $url)
 {
     $curso = Course::where('url', $course_url)->first();
     $etapa = Stage::where('url', $stage_url)->first();
     $item = Item::where('url', $url)->first();
     $tiposItem = ItemType::all()->pluck('name', 'id');
     return view('pages.items.edit', ['curso' => $curso, 'etapa' => $etapa, 'item' => $item, 'tiposItem' => $tiposItem]);
 }
Example #3
0
 public function edit(Request $request, $id)
 {
     $item = Items::find($id);
     if ($item) {
         $profits = ProfitPercentage::all('id', 'profit_name');
         $itemtype = ItemType::all();
         return view('item.edit', compact('item', 'profits', 'itemtype'));
     } else {
         return redirect()->action('ItemsController@index')->with('error', 'El producto solicitado no existe');
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $itemType = ItemType::find($request['item_type_id']);
     do {
         $itemCode = $itemType->pre_code . self::DASH . StringUtil::getRandomString();
         $items = Item::where('item_code', $itemCode)->first();
         if (empty($items)) {
             $request['item_code'] = $itemCode;
             break;
         }
     } while (true);
     return $next($request);
 }
Example #5
0
 public function search($input)
 {
     $query = ItemType::query();
     $columns = Schema::getColumnListing('itemTypes');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     ItemType::create(['type' => 'material quirurgico', 'type_description' => 'material quirurgico']);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     ItemType::truncate();
     $data = [['name' => "áo giáp"]];
     ItemType::insert($data);
 }