コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Material::create(['name' => 'w201 White', 'composition' => 'Polyester 100%', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta molestias pariatur placeat aut hic. Qui fuga nesciunt voluptates ut, cum dolorem saepe autem, doloribus delectus facilis, odit ipsum nostrum culpa.', 'image_path' => '/img/materials/rocky-i-series/w201-white.jpg', 'collection_id' => 1]);
     Material::create(['name' => 'w202 Ivory', 'composition' => 'Polyester 100%', 'description' => 'Sunt placeat illo saepe molestias natus quis consectetur ducimus dolores voluptatem voluptas maxime reprehenderit earum voluptatum veniam eveniet beatae temporibus magnam repellendus nihil corporis, voluptate laboriosam.', 'image_path' => '/img/materials/rocky-i-series/w202-ivory.jpg', 'collection_id' => 1]);
     Material::create(['name' => 'w203 Beige', 'composition' => 'Polyester 100%', 'description' => 'Suscipit consectetur, totam, neque, modi ratione accusamus nihil vero ducimus soluta amet saepe esse fuga! Officiis obcaecati sit cum placeat praesentium, dolor esse magnam corporis totam iste nisi explicabo amet.', 'image_path' => '/img/materials/rocky-i-series/w203-beige.jpg', 'collection_id' => 1]);
     Material::create(['name' => 'n101 White', 'composition' => 'Polyester 100%', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta molestias pariatur placeat aut hic. Qui fuga nesciunt voluptates ut, cum dolorem saepe autem, doloribus delectus facilis, odit ipsum nostrum culpa.', 'image_path' => '/img/materials/rocky-ii-series/n101-white.jpg', 'collection_id' => 2]);
     Material::create(['name' => 'n102 Ivory', 'composition' => 'Polyester 100%', 'description' => 'Sunt placeat illo saepe molestias natus quis consectetur ducimus dolores voluptatem voluptas maxime reprehenderit earum voluptatum veniam eveniet beatae temporibus magnam repellendus nihil corporis, voluptate laboriosam.', 'image_path' => '/img/materials/rocky-ii-series/n102-ivory.jpg', 'collection_id' => 2]);
     Material::create(['name' => 'n103 Beige', 'composition' => 'Polyester 100%', 'description' => 'Suscipit consectetur, totam, neque, modi ratione accusamus nihil vero ducimus soluta amet saepe esse fuga! Officiis obcaecati sit cum placeat praesentium, dolor esse magnam corporis totam iste nisi explicabo amet.', 'image_path' => '/img/materials/rocky-ii-series/n103-beige.jpg', 'collection_id' => 2]);
     Material::create(['name' => 's301 Ivory', 'composition' => 'Polyester 100%', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta molestias pariatur placeat aut hic. Qui fuga nesciunt voluptates ut, cum dolorem saepe autem, doloribus delectus facilis, odit ipsum nostrum culpa.', 'image_path' => '/img/materials/rocky-iii-series/s301-ivory.jpg', 'collection_id' => 3]);
     Material::create(['name' => 's302 Beige', 'composition' => 'Polyester 100%', 'description' => 'Sunt placeat illo saepe molestias natus quis consectetur ducimus dolores voluptatem voluptas maxime reprehenderit earum voluptatum veniam eveniet beatae temporibus magnam repellendus nihil corporis, voluptate laboriosam.', 'image_path' => '/img/materials/rocky-iii-series/s302-beige.jpg', 'collection_id' => 3]);
     Material::create(['name' => 's303 Brown', 'composition' => 'Polyester 100%', 'description' => 'Suscipit consectetur, totam, neque, modi ratione accusamus nihil vero ducimus soluta amet saepe esse fuga! Officiis obcaecati sit cum placeat praesentium, dolor esse magnam corporis totam iste nisi explicabo amet.', 'image_path' => '/img/materials/rocky-iii-series/s303-brown.jpg', 'collection_id' => 3]);
     /**
      * Solar Shades
      *
      */
     Material::create(['name' => 'lg02 Beige', 'composition' => 'Polyester 100%', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta molestias pariatur placeat aut hic. Qui fuga nesciunt voluptates ut, cum dolorem saepe autem, doloribus delectus facilis, odit ipsum nostrum culpa.', 'image_path' => '/img/materials/galaxy-series/lg02-beige.jpg', 'collection_id' => 4]);
     Material::create(['name' => 'lg05 Two Tone Brown', 'composition' => 'Polyester 100%', 'description' => 'Sunt placeat illo saepe molestias natus quis consectetur ducimus dolores voluptatem voluptas maxime reprehenderit earum voluptatum veniam eveniet beatae temporibus magnam repellendus nihil corporis, voluptate laboriosam.', 'image_path' => '/img/materials/galaxy-series/lg05-two-tone-brown.jpg', 'collection_id' => 4]);
     Material::create(['name' => 'lg06 Two Tone Gray', 'composition' => 'Polyester 100%', 'description' => 'Suscipit consectetur, totam, neque, modi ratione accusamus nihil vero ducimus soluta amet saepe esse fuga! Officiis obcaecati sit cum placeat praesentium, dolor esse magnam corporis totam iste nisi explicabo amet.', 'image_path' => '/img/materials/galaxy-series/lg06-two-tone-gray.jpg', 'collection_id' => 4]);
     Material::create(['name' => 'll01 White', 'composition' => 'Polyester 100%', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta molestias pariatur placeat aut hic. Qui fuga nesciunt voluptates ut, cum dolorem saepe autem, doloribus delectus facilis, odit ipsum nostrum culpa.', 'image_path' => '/img/materials/losa-series/ll01-white.jpg', 'collection_id' => 5]);
     Material::create(['name' => 'll02 Ivory', 'composition' => 'Polyester 100%', 'description' => 'Sunt placeat illo saepe molestias natus quis consectetur ducimus dolores voluptatem voluptas maxime reprehenderit earum voluptatum veniam eveniet beatae temporibus magnam repellendus nihil corporis, voluptate laboriosam.', 'image_path' => '/img/materials/losa-series/ll02-ivory.jpg', 'collection_id' => 5]);
     Material::create(['name' => 'll03 Beige', 'composition' => 'Polyester 100%', 'description' => 'Suscipit consectetur, totam, neque, modi ratione accusamus nihil vero ducimus soluta amet saepe esse fuga! Officiis obcaecati sit cum placeat praesentium, dolor esse magnam corporis totam iste nisi explicabo amet.', 'image_path' => '/img/materials/losa-series/ll03-beige.jpg', 'collection_id' => 5]);
     Material::create(['name' => 'ls01 Beige', 'composition' => 'Polyester 100%', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta molestias pariatur placeat aut hic. Qui fuga nesciunt voluptates ut, cum dolorem saepe autem, doloribus delectus facilis, odit ipsum nostrum culpa.', 'image_path' => '/img/materials/sara-series/ls01-beige.jpg', 'collection_id' => 6]);
     Material::create(['name' => 'ls02 Khaki', 'composition' => 'Polyester 100%', 'description' => 'Sunt placeat illo saepe molestias natus quis consectetur ducimus dolores voluptatem voluptas maxime reprehenderit earum voluptatum veniam eveniet beatae temporibus magnam repellendus nihil corporis, voluptate laboriosam.', 'image_path' => '/img/materials/sara-series/ls02-khaki.jpg', 'collection_id' => 6]);
     Material::create(['name' => 'ls03 Choco', 'composition' => 'Polyester 100%', 'description' => 'Suscipit consectetur, totam, neque, modi ratione accusamus nihil vero ducimus soluta amet saepe esse fuga! Officiis obcaecati sit cum placeat praesentium, dolor esse magnam corporis totam iste nisi explicabo amet.', 'image_path' => '/img/materials/sara-series/ls03-choco.jpg', 'collection_id' => 6]);
 }
コード例 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //Get material
     $materialOption = MaterialOption::where('material_option_id', '=', $id)->first();
     $materials = Material::lists('name', 'material_id');
     return view('materialoption.edit', compact('materialOption', 'materials'));
 }
コード例 #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $material = Material::find($id);
     if (isset($material)) {
         $material->delete();
     }
 }
コード例 #4
0
 public function show($collectionSlug, $materialSlug)
 {
     $material = Material::with(['collection' => function ($query) use($collectionSlug) {
         $query->whereSlug($collectionSlug)->firstOrFail();
     }])->whereSlug($materialSlug)->firstOrFail();
     return view('pages.materials.show', compact('material'));
 }
コード例 #5
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\MaterialRequest $request)
 {
     //
     $data = $request->except(['_token']);
     Material::create($data);
     return redirect()->to('material');
 }
コード例 #6
0
 public function results(Request $request)
 {
     $services = Service::name($request->get('query'))->orderBy('created_at', 'DESC')->get();
     $materials = Material::name($request->get('query'))->orderBy('created_at', 'DESC')->get();
     $results = $materials->merge($services);
     return view('results')->with('results', $results)->with('title', $request->get('query'));
 }
コード例 #7
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $product = Product::find($id);
     $seasons = Season::pluck('slug', 'id')->toArray();
     $materials = Material::pluck('name_ru', 'id');
     $categories = Category::get()->linknodes()->pluck('name_ru', 'id');
     return response()->view('back.products.edit', compact('product', 'seasons', 'materials', 'categories'));
 }
コード例 #8
0
ファイル: MaterialSeeder.php プロジェクト: haseo2015/laravel
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create('it_IT');
     $materials = 30;
     $projectIds = $this->getProjectsIdsArray();
     for ($c = 0; $c < $materials; $c++) {
         $name = $faker->text(25);
         $slug = Str::slug($name);
         $mats = Material::create(['material_name' => $name, 'slug' => $slug, 'count' => $faker->randomDigitNotNull, 'punteggio' => 10, 'is_published' => 1, 'published_at' => $faker->dateTimeThisYear($max = 'now')]);
         $mats->projects()->sync($faker->randomElements($projectIds, mt_rand(1, 5)));
     }
 }
コード例 #9
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @param Phpgmaps $gmpas
  * @return Response
  */
 public function show($id, Phpgmaps $gmpas)
 {
     $material = Material::findOrFail($id);
     $config['center'] = $material->lat . ', ' . $material->lng;
     $config['zoom'] = 15;
     $gmpas->initialize($config);
     $marker = [];
     $marker['position'] = $material->lat . ', ' . $material->lng;
     $gmpas->add_marker($marker);
     $map = $gmpas->create_map();
     return view('materials.show')->with('map', $map)->with('material', $material)->with('title', $material->name);
 }
コード例 #10
0
 public function index()
 {
     $materials = Material::all();
     //$response = json_decode($materials);
     return response()->json($materials);
 }
コード例 #11
0
 public function delete($id)
 {
     Material::findOrFail($id)->delete();
     return redirect('materiales');
 }
コード例 #12
0
 public function getFilter($request)
 {
     $query = Material::with('categories', 'levels', 'languageFocuses', 'activityUses', 'pupilTasks', 'book');
     //names of eager
     if (trim($request->book) !== '') {
         $query = $query->whereHas('book', function ($bookQuery) use($request) {
             $bookQuery->where('book', $request->book);
         });
     }
     if ($request->level) {
         for ($i = 0; $i < count($request->level); $i++) {
             $query = $query->whereHas('levels', function ($levelQuery) use($request, $i) {
                 $levelQuery->where('level', $request->level[$i]);
             });
         }
     }
     if ($request->category_list) {
         for ($i = 0; $i < count($request->category_list); $i++) {
             $query = $query->whereHas('categories', function ($categoryQuery) use($request, $i) {
                 $categoryQuery->where('category', $request->category_list[$i]);
             });
         }
     }
     if ($request->language_focus) {
         for ($i = 0; $i < count($request->language_focus); $i++) {
             $query = $query->whereHas('languageFocuses', function ($focusQuery) use($request, $i) {
                 $focusQuery->where('language_focus', $request->language_focus[$i]);
             });
         }
     }
     if ($request->activity_use) {
         for ($i = 0; $i < count($request->activity_use); $i++) {
             $query = $query->whereHas('activityUses', function ($activityQuery) use($request, $i) {
                 $activityQuery->where('activity_use', $request->activity_use[$i]);
             });
         }
     }
     if ($request->pupil_task) {
         for ($i = 0; $i < count($request->pupil_task); $i++) {
             $query = $query->whereHas('pupilTasks', function ($pupilQuery) use($request, $i) {
                 $pupilQuery->where('pupil_task', $request->pupil_task[$i]);
             });
         }
     }
     if ($request->time_needed_class) {
         $class = explode(',', $request->time_needed_class);
         $query = $query->whereBetween('time_needed_class', $class);
     }
     if ($request->time_needed_prep) {
         $prep = explode(',', $request->time_needed_prep);
         $query = $query->whereBetween('time_needed_prep', $prep);
     }
     return $query->get();
     // make the query and load the data
 }
コード例 #13
0
 public function home()
 {
     $materials = Auth::User()->material->sortByDesc('updated_at');
     $liked = Material::whereLiked(Auth::User()->id)->with('likeCounter')->get();
     return view('user.home', compact('materials', 'liked'));
 }
コード例 #14
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //SOFT DELETE???
     Material::where('material_id', '=', $id)->delete();
     return redirect('material');
 }
コード例 #15
0
ファイル: BlocksController.php プロジェクト: jhansen69/7Days
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $user = Auth::user();
     $block = Block::findOrNew($id);
     foreach (Material::get(array('name'))->toArray() as $mat) {
         $materials[$mat['name']] = $mat['name'];
     }
     $blocks = array(0 => 'None');
     foreach (Block::select('name')->orderBy('name', 'ASC')->get()->toArray() as $pointer) {
         $blocks[$pointer['name']] = $pointer['name'];
     }
     $items = array(0 => 'None');
     foreach (Item::select('name')->orderBy('name', 'ASC')->get()->toArray() as $pointer) {
         $items[$pointer['name']] = $pointer['name'];
     }
     $shapes = array(0 => 'None');
     foreach (BlockProperties::select('value')->where('key', 'Shape')->groupBy('value')->get()->toArray() as $pointer) {
         $shapes[$pointer['value']] = $pointer['value'];
     }
     $models = array(0 => 'None');
     foreach (BlockProperties::select('value')->where('key', 'Model')->groupBy('value')->get()->toArray() as $pointer) {
         $models[$pointer['value']] = $pointer['value'];
     }
     $meshes = array(0 => 'None');
     foreach (BlockProperties::select('value')->where('key', 'Mesh')->groupBy('value')->get()->toArray() as $pointer) {
         $meshes[$pointer['value']] = $pointer['value'];
     }
     $groups = array(0 => 'None');
     foreach (BlockProperties::select('value')->where('key', 'Group')->groupBy('value')->get()->toArray() as $pointer) {
         $groups[$pointer['value']] = $pointer['value'];
     }
     $classes = array(0 => 'None');
     foreach (BlockProperties::select('value')->where('key', 'Class')->groupBy('value')->get()->toArray() as $pointer) {
         $classes[$pointer['value']] = $pointer['value'];
     }
     $droppables = array(0 => 'None');
     foreach (Block::get(array('name'))->toArray() as $pointer) {
         $droppables[$pointer['name']] = $pointer['name'];
     }
     foreach (Item::get(array('name'))->toArray() as $pointer) {
         $droppables[$pointer['name']] = $pointer['name'];
     }
     $placements = array(0 => 'None');
     foreach (BlockProperties::select('value')->where('key', 'Place')->groupBy('value')->get()->toArray() as $pointer) {
         $placements[$pointer['value']] = $pointer['value'];
     }
     $collisions = array('bullet' => 'bullet', 'melee' => 'melee', 'movement' => 'movement', 'rocket' => 'rocket', 'sight' => 'sight');
     $sounds = array(0 => "No sound");
     $buffs = array(0 => "No buff");
     $loot = array(0 => "No loot table");
     $tags = array(0 => "No tags", 'Door' => "Door", 'Gore' => "Gore", 'TreeTrunk' => "TreeTrunk", 'Window' => "Window");
     $meshDamages = array(0 => "None", "Door/Door_DMG0" => "Door/Door_DMG0", "Door/Door_DMG1" => "Door/Door_DMG1", "Door/Door_DMG2" => "Door/Door_DMG2", "Door/Door_DMG3" => "Door/Door_DMG3", "Door/Door_DMG4" => "Door/Door_DMG4", "Door/Hatch_DMG0" => "Door/Hatch_DMG0", "Door/Hatch_DMG1" => "Door/Hatch_DMG1", "Door/Hatch_DMG2" => "Door/Hatch_DMG2", "Door/Hatch_DMG3" => "Door/Hatch_DMG3", "Door/Hatch_DMG4" => "Door/Hatch_DMG4");
     $particleNames = array(0 => "None", "campfire" => "campfire", "candle_flame" => "candle_flame", "candleWall_flame" => "candleWall_flame", "ember_pile" => "ember_pile", "forge" => "hotembers", "hotembers" => "hotembers", "sandstorm" => "sandstorm", "smokestorm" => "smokestorm", "snowstorm1" => "snowstorm1", "torch_wall" => "torch_wall");
     $particleOnDeath = array(0 => "None", "treeGib_birch" => "treeGib_birch", "treeGib_burnt" => "treeGib_burnt");
     $properties = array('BigDecorationRadius' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'BuffsWhenWalkedOn' => array('type' => 'select', 'options' => $buffs, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'CanDecorateOnSlopes' => array('type' => 'checkbox', 'options' => '', 'value' => true, 'attribute' => 'property', 'parameters' => ''), 'CanMobsSpawnOn' => array('type' => 'checkbox', 'options' => '', 'value' => true, 'attribute' => 'property', 'parameters' => ''), 'CanPickup' => array('type' => 'checkbox', 'options' => '', 'value' => false, 'attribute' => 'property', 'parameters' => ''), 'CanPlayersSpawnOn' => array('type' => 'checkbox', 'options' => '', 'value' => true, 'attribute' => 'property', 'parameters' => ''), 'Class' => array('type' => 'select', 'options' => $classes, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'CloseSound' => array('type' => 'select', 'options' => $sounds, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Collide' => array('type' => 'selectmulti', 'options' => $collisions, 'value' => '', 'attribute' => 'property', 'parameters' => ''), 'CustomIcon' => array('type' => 'select', 'options' => $blocks, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'CustomIconTint' => array('type' => 'text', 'options' => '', 'value' => '000000', 'attribute' => 'property', 'parameters' => ''), 'Damage' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Damage_received' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Density' => array('type' => 'number', 'options' => '', 'value' => 1, 'attribute' => 'property', 'parameters' => ''), 'DowngradeBlock' => array('type' => 'select', 'options' => $blocks, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'DropScale' => array('type' => 'number', 'options' => '', 'value' => 2, 'attribute' => 'property', 'parameters' => ''), 'FallDamage' => array('type' => 'checkbox', 'options' => '', 'value' => true, 'attribute' => 'property', 'parameters' => ''), 'FallOver' => array('type' => 'checkbox', 'options' => '', 'value' => false, 'attribute' => 'property', 'parameters' => ''), 'FuelValue' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'GrassBlock1' => array('type' => 'select', 'options' => $blocks, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'GrassBlock2' => array('type' => 'select', 'options' => $blocks, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Group' => array('type' => 'select', 'options' => $groups, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'HeatMapFrequency' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'HeatMapStrength' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'HeatMapTime' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'IsDeveloper' => array('type' => 'checkbox', 'options' => '', 'value' => false, 'attribute' => 'property', 'parameters' => ''), 'IsPlant' => array('type' => 'checkbox', 'options' => '', 'value' => false, 'attribute' => 'property', 'parameters' => ''), 'IsTerrainDecoration' => array('type' => 'checkbox', 'options' => '', 'value' => true, 'attribute' => 'property', 'parameters' => ''), 'Light' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'LiquidMoving' => array('type' => 'number', 'options' => array(0 => "N/A", 'waterMoving' => 'waterMoving', 'waterMovingBucket' => 'waterMovingBucket'), 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'LiquidStatic' => array('type' => 'number', 'options' => array(0 => "N/A", 'water' => 'water', 'waterStaticBucket' => 'waterStaticBucket'), 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'LootList' => array('type' => 'select', 'options' => $loot, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'LPHardnessScale' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Map.Color' => array('type' => 'text', 'options' => '', 'value' => '', 'attribute' => 'property', 'parameters' => ''), 'Material' => array('type' => 'select', 'options' => $materials, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Mesh' => array('type' => 'select', 'options' => $meshes, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Mesh-Damage-1' => array('type' => 'select', 'options' => $meshDamages, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Mesh-Damage-2' => array('type' => 'select', 'options' => $meshDamages, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Mesh-Damage-3' => array('type' => 'select', 'options' => $meshDamages, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Mesh-Damage-4' => array('type' => 'select', 'options' => $meshDamages, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Mesh-Damage-5' => array('type' => 'select', 'options' => $meshDamages, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Model' => array('type' => 'select', 'options' => $models, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'ModelOffset' => array('type' => 'text', 'options' => '', 'value' => array(0, 0, 0), 'attribute' => 'property', 'parameters' => ''), 'MovementFactor' => array('type' => 'number', 'options' => '', 'value' => 1, 'attribute' => 'property', 'parameters' => ''), 'MultiBlockDim' => array('type' => 'text', 'options' => '', 'value' => array(1, 1, 1), 'attribute' => 'property', 'parameters' => ''), 'OpenSound' => array('type' => 'select', 'options' => $sounds, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'ParticleName' => array('type' => 'select', 'options' => $particleNames, 'value' => 'none', 'attribute' => 'property', 'parameters' => ''), 'ParticleOffset' => array('type' => 'text', 'options' => '', 'value' => array(0, 0, 0), 'attribute' => 'property', 'parameters' => ''), 'ParticleOnDeath' => array('type' => 'select', 'options' => $particleOnDeath, 'value' => 'none', 'attribute' => 'property', 'parameters' => ''), 'PickupTarget' => array('type' => 'select', 'options' => array_merge($blocks, $items), 'value' => 'none', 'attribute' => 'property', 'parameters' => ''), 'Place' => array('type' => 'select', 'options' => $placements, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'PlaceAltBlockValue' => array('type' => 'selectmulti', 'options' => $blocks, 'value' => 'none', 'attribute' => 'property', 'parameters' => ''), 'PlaceEverywhere' => array('type' => 'checkbox', 'options' => '', 'value' => false, 'attribute' => 'property', 'parameters' => ''), 'Shape' => array('type' => 'select', 'options' => $shapes, 'value' => '0', 'attribute' => 'property', 'parameters' => ''), 'ShapeMinBB' => array('type' => 'text', 'options' => '', 'value' => array(0, 0, 0), 'attribute' => 'property', 'parameters' => ''), 'SiblingBlock' => array('type' => 'select', 'options' => $blocks, 'value' => '0', 'attribute' => 'property', 'parameters' => ''), 'SiblingDirection' => array('type' => 'text', 'options' => '', 'value' => array(0, 0, 0), 'attribute' => 'property', 'parameters' => ''), 'SmallDecorationRadius' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'StateChange' => array('type' => 'select', 'options' => array('none' => "Does not change", 'PlantGrowing' => 'Grows like a plant', 'UpgradeBlock' => 'Upgradable Block', 'UpgradeRated' => 'Changes like concrete', 'Explosion' => 'Make it explodable (Gas pumps)'), 'value' => 'none', 'attribute' => 'class', 'parameters' => ''), 'Tag' => array('type' => 'select', 'options' => $tags, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Texture' => array('type' => 'text', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'UpwardsCount' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'UpgradeRated.BlockCombined' => array('type' => 'select', 'options' => $blocks, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'UpgradeRated.Rate' => array('type' => 'number', 'options' => '', 'value' => 15, 'attribute' => 'property', 'parameters' => ''), 'UpgradeRated.ToBlock' => array('type' => 'select', 'options' => $blocks, 'value' => 0, 'attribute' => 'property', 'parameters' => ''), 'Weight' => array('type' => 'number', 'options' => '', 'value' => 0, 'attribute' => 'property', 'parameters' => ''));
     foreach ($properties as $key => $prop) {
         foreach ($block->properties as $bprop) {
             $parameters = array('ToBlock' => 0, 'Item' => 0, 'ItemCount' => 0, 'UpgradeHitCount' => 0, 'Next' => 0, 'GrowthRate' => 0, 'FertileLevel' => 0, 'IsRandom' => false, 'LightLevelStay' => 0, 'GrowIfAnythinOnTop' => false, 'IsGrowOnTopEnabled' => false, 'GrowOnTop' => false, 'GrowthRate' => false, 'ParticleIndex' => 0, 'RadiusBlocks' => 0, 'BlockDamage' => 0, 'RadiusEntities' => 0, 'EntityDamage' => 0);
             if ($bprop->attribute == 'class' && in_array($bprop->value, array('UpgradeBlock', 'PlantGrowing', 'Explosion'))) {
                 /* parameters in format Key&Value|Key&Value */
                 if ($bprop->parameters != '') {
                     $param = explode("|", $bprop->parameters);
                     foreach ($param as $p) {
                         $t = explode("&", $p);
                         $parameters[$t[0]] = $t[1];
                     }
                 }
                 $properties['StateChange']['value'] = $bprop->value;
                 $properties['StateChange']['attribute'] = $bprop->attribute;
                 $properties['StateChange']['parameters'] = $parameters;
             } else {
                 if ($bprop->key == $key) {
                     if ($bprop->parameters != '') {
                         $param = explode("|", $bprop->parameters);
                         foreach ($param as $p) {
                             $t = explode("&", $p);
                             $parameters[$t[0]] = $t[1];
                         }
                     }
                     /* handle breaking up things like multi-dim, model offset, etc into pieces */
                     $value = $bprop->value;
                     if ($key == 'ModelOffset' || $key == 'MultiBlockDim' || $key == 'SiblingDirection' || $key == 'ParticleOffset' || $key == 'ShapeMinBB') {
                         $value = explode(",", $value);
                     }
                     $properties[$key]['value'] = $value;
                     $properties[$key]['attribute'] = $bprop->attribute;
                     $properties[$key]['parameters'] = $parameters;
                 }
             }
         }
     }
     if ($properties['StateChange']['value'] == 'none') {
         $properties['StateChange']['parameters'] = $parameters;
     }
     return view('forms.block', compact('block', 'user', 'properties', 'materials', 'blocks', 'items'));
 }
コード例 #16
0
 public function getResults(Requests\SeachMaterialRequest $request)
 {
     $input = \Illuminate\Support\Facades\Request::get('category_id');
     $materials = Material::where('category_id', $input)->get();
     return view('search.results', compact('materials'));
 }
コード例 #17
0
ファイル: Importer.php プロジェクト: jhansen69/7Days
 public function parseMaterial($content, $userid, $alpha, $core = 0)
 {
     /*
      * always purge all existing core materials first
      *
      */
     Material::truncate();
     $processed = 0;
     foreach ($content['material'] as $item) {
         $name = $item['@attributes']['id'];
         if ($name != '') {
             $record = array("name" => $name);
             foreach ($item['property'] as $prop) {
                 $prop = $prop['@attributes'];
                 $record[$prop['name']] = $prop['value'];
             }
             $record = array_merge($record, array('user_id' => $userid, 'core' => 1, 'mod_id' => 1, 'alpha' => $alpha));
             Material::create($record);
             $processed++;
         }
     }
 }