diff --git a/.env.example b/.env.example index cd06cc8..3958b4a 100644 --- a/.env.example +++ b/.env.example @@ -33,3 +33,6 @@ PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 + +POE_VERSION=3.2 +POE_LEAGUES='Abyss,Hardcore Abyss,SSF Abyss,SSF Abyss HC,10 Day Mayhem' diff --git a/app/Account.php b/app/Account.php index fa4ea43..ce5b7d0 100644 --- a/app/Account.php +++ b/app/Account.php @@ -28,7 +28,7 @@ public function ladderChars() protected function getNewAccInfo($acc){ // $html = HtmlDomParser::file_get_html('https://www.pathofexile.com/account/view-profile/'. $acc .'/characters'); - //problem with HtmlDomParser::file_get_html with php 7.1 + //problem with HtmlDomParser::file_get_html with php 7.1 //get with Guzzle and then str_get_html $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://www.pathofexile.com/', @@ -37,7 +37,7 @@ protected function getNewAccInfo($acc){ $response = $client->request('GET', '/account/view-profile/'. $acc .'/characters'); $body = $response->getBody()->getContents(); $html = HtmlDomParser::str_get_html($body); - + //filter for accoutn name $name = $html->find('.container-content h2',0); @@ -79,7 +79,7 @@ public function updateLastChar(){ private function getLastCharFrom($html){ if($html==null){ // $html = HtmlDomParser::file_get_html('https://www.pathofexile.com/account/view-profile/'. $this->name .'/characters'); - //problem with HtmlDomParser::file_get_html with php 7.1 + //problem with HtmlDomParser::file_get_html with php 7.1 //get with Guzzle and then str_get_html $client = new \GuzzleHttp\Client([ @@ -136,7 +136,7 @@ public function getItemsFor($char){ //get cahce if no cache get from poe api $acc=$this->name; $key='items/'.$acc.'/'.$char; - $items_response = \Cache::remember($key, 5, function () use ($acc,$char){ + $items_response = \Cache::remember($key, config('app.poe_cache_time'), function () use ($acc,$char){ $client = new \GuzzleHttp\Client(); //make Requests to PathOfExile website to retrieve Character Items try { diff --git a/app/Build.php b/app/Build.php deleted file mode 100644 index 60aa748..0000000 --- a/app/Build.php +++ /dev/null @@ -1,91 +0,0 @@ -attributes['tree_data'] = $tree_data; - } - - public function getTreeDataAttribute($value) - { - // dd($value); - $tree_data = base64_decode($value); - $tree_data = gzuncompress($tree_data); - return json_decode($tree_data, true); - } - - // Item_Data Mutator & Accessor - public function setItemDataAttribute($value) - { - $item_data = gzcompress($value); - $item_data = base64_encode($item_data); - $this->attributes['item_data'] = $item_data; - } - - public function getItemDataAttribute($value) - { - $item_data = base64_decode($value); - $item_data = gzuncompress($item_data); - return json_decode($item_data, true); - } - - // Stats Mutator & Accessor - public function setStatsAttribute($value) - { - $stats = gzcompress(json_encode($value, true)); - $stats = base64_encode($stats); - $this->attributes['stats'] = $stats; - } - - public function getStatsAttribute($value) - { - $stats = base64_decode($value); - $stats = gzuncompress($stats); - return json_decode($stats, true); - } - - public function getStats() - { - $stManager = new Stats_Manager; - - //items - $banItems = ['Flask', 'Weapon2', 'Offhand2']; - if (isset($_GET['offHand'])) { - $banItems = ['Flask', 'Weapon', 'Offhand']; - } - - $items = array_filter($this->item_data['items'], function ($item) use (&$banItems) { - return in_array($item['inventoryId'], $banItems); - }); - - $stManager->addItems($items); - - //tree - $treeNodesJewels = new CharacterTreePoints; - $nodes = $treeNodesJewels->getPoints($this->tree_data); - $stManager->addTreeNode($nodes); - - //base stats - $character = $this->item_data['character']; - $baseStat = new Base_Stats; - $baseStat = $baseStat->getStats($character['level'], $character['classId']); - foreach ($baseStat as $stat) { - $stManager->addBaseMods($stat); - } - - return $stManager->getStats(); - } -} diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index b49b66a..7aca1fa 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -10,13 +10,12 @@ class ApiController extends CacheController { public function getItems(Request $request) { - if (!$request->has('account') && !$request->has('character')) { return; } $b = explode('::', $request->input('account')); if($b[0] == 'build'){ - return \App\Build::find($b[1])->item_data['items']; + return \App\Snapshot::where('hash','=',$b[1])->get()->item_data['items']; } $acc=$request->input('account'); $char=$request->input('character'); @@ -34,9 +33,13 @@ public function getStats(Request $request) $b = explode('::', $acc); if ($b[0] == 'build') { - return \App\Build::find($b[1])->getStats(); + $build=\App\Snapshot::where('hash','=',$b[1])->first(); + if(!$build){ + return []; + } + return $build->getStats(); } - //getItemsCache() is from parant class CacheController + //getStatsCache() is from parant class CacheController return $this->getStatsCache($acc, $char); } @@ -82,12 +85,11 @@ public function getFavsChars() public function getLadder(Request $request) { - + if ($request->has('searchFilter')) { $respond = \App\LadderCharacter::with('account')->whereHas('account', function ($query) use (&$request) { $query->where('name', 'like', '%'.$request->input ('searchFilter').'%'); })->orWhere('name', 'like', '%'.$request->input ('searchFilter').'%')->paginate(); - return $respond; } @@ -116,7 +118,7 @@ public function getLadder(Request $request) return $respond; } - if ($request->has('leagueFilter')) { + if ($request->has('leagueFilter')) { $respond = \App\LadderCharacter::with('account')->where('league', '=', $request->input('leagueFilter')) ->orderBy('rank', 'asc')->paginate(); return $respond; @@ -161,7 +163,6 @@ public function getXML(Request $request) $itemsData = $this->getItemsCache($acc, $char, true); $treeJson = $this->getTreeCache($acc, $char); $pob = new PobXMLBuilder($itemsData, $treeJson); - // show XML ----> // Header('Content-type: text/xml'); @@ -170,59 +171,42 @@ public function getXML(Request $request) return $pob->encodedXML(); } - public function defaultBuild(Request $request) + public function getBuild($hash) { - $id = $request->input('id'); - $name = $request->input('name'); - - $build = \App\Build::where('id', '=', $id)->where('name', '=', $name)->first(); - + $build = \App\Snapshot::where('hash', '=', $hash)->first(); return $build; } public function saveBuild(Request $request) { - $client = new \GuzzleHttp\Client(); - $treeData = $client->request( - 'GET', - 'https://www.pathofexile.com/character-window/get-passive-skills', - [ - 'query' => [ - 'accountName' => $request->input('account'), - 'character' => $request->input('char') - ] - ] - ); - $treeData = (string)$treeData->getBody(); - - $itemData = $client->request( - 'GET', - 'https://www.pathofexile.com/character-window/get-items', - [ - 'query' => [ - 'accountName' => $request->input('account'), - 'character' => $request->input('char') - ] - ] - ); - $itemData = (string)$itemData->getBody(); + $acc=$request->input('account'); + $char=$request->input('char'); + + //getItemsCache() true to get the whole respons + $itemData = $this->getItemsCache($acc, $char, true); + $itemData = json_encode($itemData); + $treeData = $this->getTreeCache($acc, $char); + $treeData = json_encode($treeData); + + $hash = md5($treeData.'/'.$itemData); + $snapshot = \App\Snapshot::where('hash', '=', $hash)->first(); + if(!$snapshot){ + $version = env('POE_VERSION'); + $original_char = $acc .'/'. $char; + $snapshot = \App\Snapshot::create([ + 'hash' => $hash, + 'tree_data' => $treeData, + 'item_data' => $itemData, + 'original_char' => $original_char, + 'poe_version' => $version + ]); + $snapshot->original_level = $snapshot->item_data['character']['level']; + $snapshot->save(); + } - $currentLeagues = explode(',', env('POE_LEAGUES')); - $buildName = str_replace(' ', '_', $request->input('name')); - $build = \App\Build::create([ - 'name' => $buildName, - 'tree_data' => $treeData, - 'item_data' => $itemData, - 'poe_version' => $currentLeagues[0] - ]); - $build->stats = $build->getStats(); - $build->save(); - - $favStore = $build->item_data['character']; - $favStore['name'] = $buildName; + $favStore = $snapshot->item_data['character']; $favStore['league'] = 'localBuild'; - $favStore['buildId'] = $build->id; - + $favStore['buildId'] = $snapshot->hash; return $favStore; } } diff --git a/app/Http/Controllers/CacheController.php b/app/Http/Controllers/CacheController.php index 175a8ff..c98c417 100644 --- a/app/Http/Controllers/CacheController.php +++ b/app/Http/Controllers/CacheController.php @@ -20,7 +20,7 @@ class CacheController extends BaseController //get chars for acc from cache if no get from poe site protected function getCharsCache($acc) { - $chars = \Cache::remember($acc, 5, function () use ($acc) { + $chars = \Cache::remember($acc, config('app.poe_cache_time'), function () use ($acc) { $client = new \GuzzleHttp\Client(); try { $response = $client->request( @@ -57,7 +57,6 @@ protected function getCharsCache($acc) return $chars; } - //get items for acc/char from cache if no get from poe site protected function getItemsCache($acc, $char, $response=false) { @@ -83,43 +82,10 @@ protected function getStatsCache($acc, $char) } // dd(config('app.poe_cache_time')); $stats = \Cache::remember($key, config('app.poe_cache_time'), function () use ($acc,$dbAcc,$char,$itemsRes) { - $stManager = new Stats_Manager; - - //add Stats from Items - - //filter for secondary items and flasks - $banItems = ['Flask', 'Weapon2', 'Offhand2']; - if (isset($_GET['offHand'])) { - $banItems = ['Flask', 'Weapon', 'Offhand']; - } - - $filterItems = array_filter($itemsRes['items'], function($item) use (&$banItems) { - return !in_array($item['inventoryId'], $banItems); - }); - - $stManager->addItems($filterItems); - if ($dbAcc->last_character==$itemsRes['character']['name']) { $dbAcc->updateLastCharInfo($itemsRes); } - //end Stats from Items - - //add Stats from Tree - //make Requests to PathOfExile website to retrieve Pasive Tree - - $treeNodesJewels = new CharacterTreePoints; - $nodes = $treeNodesJewels->getPoints($this->getTreeCache($acc, $char)); - $stManager->addTreeNode($nodes); - - //add Stats Base for Class and Level - $character = $itemsRes['character']; - $baseStat = new Base_Stats; - $baseStat = $baseStat->getStats($character['level'], $character['classId']); - foreach ($baseStat as $stat) { - $stManager->addBaseMods($stat); - } - //end Stats Base - + $stManager = new Stats_Manager($itemsRes, $this->getTreeCache($acc, $char)); return $stManager->getStats(); }); @@ -142,15 +108,10 @@ public function getTreeCache($acc, $char) ] ] ); - + return json_decode((string)$responseTree->getBody(), true); }); } - protected function getLocalItems(Request $request) - { - $jsonAcc = \Storage::disk('accounts')->get($request->input('accName') . '.txt'); - $acc = json_decode($jsonAcc); - return response()->json($acc); - } + } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/ProfileController.php similarity index 59% rename from app/Http/Controllers/HomeController.php rename to app/Http/Controllers/ProfileController.php index 10a4d51..2b80584 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/ProfileController.php @@ -7,7 +7,7 @@ use App\Stash; use App\Item; -class HomeController extends CacheController +class ProfileController extends CacheController { /** * Create a new controller instance. @@ -19,36 +19,6 @@ public function __construct() // $this->middleware('auth'); } - /** - * Show the application dashboard. - * - * @return \Illuminate\Http\Response - */ - public function index(Request $request) - { - if($request->cookie('default-acc')){ - //return redirect()->route('view.profile'); - } - return view('index'); - } - - public function home() - { - return view('index'); - } - - public function profileDefault(Request $request) - { - $char = ''; - $acc = $request->cookie('default-acc'); - if(!$acc){ - flash('No main profile .', 'warning'); - return redirect()->route('home'); - } - - return redirect()->route('get.profile',$acc); - } - public function postProfile(Request $request) { $acc = $request->input('account'); @@ -62,16 +32,6 @@ public function postProfile(Request $request) return redirect()->route('get.profile',$acc); } - //set default-acc for profile - public function postSetProfile(Request $request){ - //session(['default-acc' => $request->input('account')]); - $acc=$request->input('account'); - flash('Аccount '.$acc.' is set as your main profil next time you load '.config('app.url').'/profile is going to load '.$acc, 'success'); - - return redirect()->route('get.profile',$acc) - ->withCookie(cookie()->forever('default-acc', $acc, null, null, false, false)); - //return redirect()->route('view.profile'); - } public function getProfile($acc) { //getCharsCache() is from parant class CacheController @@ -97,16 +57,16 @@ public function getProfile($acc) $dbAcc->updateViews(); } + $chars = collect($chars); return view('profile', compact('acc', 'char', 'chars', 'dbAcc')); } - public function profile($acc, $char) + public function getProfileChar($acc, $char) { //getCharsCache() is from parant class CacheController $chars = $this->getCharsCache($acc); if(!$chars){ flash('Аccount is private or does not exist. ', 'warning'); - return redirect()->route('home'); } $dbAcc = \App\Account::with(['ladderChars', 'streamer'])->where('name', $acc)->first(); @@ -121,47 +81,38 @@ public function profile($acc, $char) flash('Character with name "'.$char.'" does not exist in account '.$acc.' or is removed.', 'warning'); return redirect()->route('get.profile',$acc); } - // json_encode($value [, $options, $depth]) + $chars = collect($chars); return view('profile', compact('acc', 'char', 'chars', 'dbAcc')); } - public function getProfileRanks($acc){ - + public function getProfileRanks($acc) + { $rankArchives = \App\LadderCharacter::with('account')->whereHas('account', function ($query) use (&$acc) { $query->where('name', '=', $acc); })->get(); - $dbAcc = \App\Account::with(['ladderChars', 'streamer'])->where('name', $acc)->first(); - return view('ranks', compact('acc', 'rankArchives', 'dbAcc')); } public function indexBuild() { - $acc = ''; - $char = ''; - - $dbAcc = '[]'; - $chars = null; - - return view('profile', compact('acc', 'char', 'chars', 'dbAcc')); + $build = null; + $loadBuild = "true"; + return view('profile', compact('acc', 'build', 'loadBuild')); } - public function showBuild($id, $name) + public function showBuild($hash) { - $build = \App\Build::where('id', '=', $id)->where('name', '=', $name)->first(); + $build = \App\Snapshot::where('hash', '=', $hash)->first(); + $loadBuild = "true"; + $acc = 'build::'.$hash; if ($build == null) { - flash("Wrong build Name")->warning()->important(); - return redirect()->route('index.builds'); + flash("404 Build snapshot ".$hash." Not Found")->warning()->important(); + return view('profile', compact('acc', 'build', 'loadBuild')); } - - $acc = 'build::'.$id; - $char = $build->name; - - $dbAcc = $build; - $chars = null; - - return view('profile', compact('acc', 'char', 'chars', 'dbAcc')); + // $char = ""; + // $dbAcc = $build; + return view('profile', compact('acc', 'build', 'loadBuild')); } } diff --git a/app/Http/Controllers/SkillTreeController.php b/app/Http/Controllers/SkillTreeController.php new file mode 100644 index 0000000..aaa7e10 --- /dev/null +++ b/app/Http/Controllers/SkillTreeController.php @@ -0,0 +1,36 @@ +middleware('auth'); + } + + public function showSkillTree(){ + return view('tree'); + } + + public function getPassiveSkills() + { + $b = explode('::', $_GET['accountName']); + if($b[0] == 'build'){ + $snapshot=\App\Snapshot::where('hash','=',$b[1])->first(); + return $snapshot->tree_data; + } + $dbAcc = \App\Account::where('name', $_GET['accountName'])->first(); + $acc=$dbAcc->name; + $char=$_GET['character']; + $responseThree = $this->getTreeCache($acc, $char); + return $responseThree; + } +} diff --git a/app/Parse_mods/Stats_Manager.php b/app/Parse_mods/Stats_Manager.php index b9f05aa..8bd8e03 100644 --- a/app/Parse_mods/Stats_Manager.php +++ b/app/Parse_mods/Stats_Manager.php @@ -1,81 +1,6 @@ stats = [ 'misc' => [ - new Totems, - new Rarity, - new Quantity, - new Skill_Effect_Duration, - new Projectile_Speed, - new Flask_Charges_Gained, - new Flask_Effect_Duration, - new Reduced_Flask_Charges, - new Effect_of_Curses, - new Reduced_Mana_Reserved, - new Effect_of_Auras, - new Physical_Attack_Life_Leech, - new Physical_Attack_Mana_Leech, - new Totem_Damage, - new Totem_Life, - new Totem_Placement_Speed, - new Totem_Duration, - new Totem_Physical_Reduction, - new Totem_Resistances, - new Endurance_Charges, - new Endurance_Charges_Duration, - new Power_Charges, - new Power_Charges_Duration, - new Frenzy_Charges, - new Frenzy_Charges_Duration, + new misc_stats\Totems, + new misc_stats\Rarity, + new misc_stats\Quantity, + new misc_stats\Skill_Effect_Duration, + new misc_stats\Projectile_Speed, + new misc_stats\Flask_Charges_Gained, + new misc_stats\Flask_Effect_Duration, + new misc_stats\Reduced_Flask_Charges, + new misc_stats\Effect_of_Curses, + new misc_stats\Reduced_Mana_Reserved, + new misc_stats\Effect_of_Auras, + new misc_stats\Physical_Attack_Life_Leech, + new misc_stats\Physical_Attack_Mana_Leech, + new misc_stats\Totem_Damage, + new misc_stats\Totem_Life, + new misc_stats\Totem_Placement_Speed, + new misc_stats\Totem_Duration, + new misc_stats\Totem_Physical_Reduction, + new misc_stats\Totem_Resistances, + new misc_stats\Endurance_Charges, + new misc_stats\Endurance_Charges_Duration, + new misc_stats\Power_Charges, + new misc_stats\Power_Charges_Duration, + new misc_stats\Frenzy_Charges, + new misc_stats\Frenzy_Charges_Duration, ], 'defense' => [ - new Resist_Fire, - new Resist_Cold, - new Resist_Lightning, - new Resist_Chaos, - new Armor, - new Percentage_Armor, - new Evasion, - new Percentage_Evasion, - new Life, - new Percentage_Life, - new Mana, - new Percentage_Mana, - new Energy_Shield, - new Percentage_ES, - new Strength, - new Intelligence, - new Dexterity, - new Block, - new Life_Regen, - new Mana_Regen_Rate, + new defense_stats\Resist_Cold, + new defense_stats\Resist_Cold, + new defense_stats\Resist_Lightning, + new defense_stats\Resist_Chaos, + new defense_stats\Armor, + new defense_stats\Percentage_Armor, + new defense_stats\Evasion, + new defense_stats\Percentage_Evasion, + new defense_stats\Life, + new defense_stats\Percentage_Life, + new defense_stats\Mana, + new defense_stats\Percentage_Mana, + new defense_stats\Energy_Shield, + new defense_stats\Percentage_ES, + new base_stats\Strength, + new base_stats\Intelligence, + new base_stats\Dexterity, + new defense_stats\Block, + new defense_stats\Life_Regen, + new defense_stats\Mana_Regen_Rate, + new defense_stats\Movement_Speed ], 'offense' => [ - new Attack_Speed, - new Cast_Speed, - new Wands_Damage, - new Physical_Damage, - new Melee_Phys_Damage, - new Attack_Critical_Chance, - new Spells_Critical_Chance, - new Radius_of_Area_Skills, - new Area_Damage, - new Attack_Critical_Multiplier, - new Spell_Critical_Multiplier, - new Spell_Damage, - new Elemental_Damage, - new Weapons_Elemental_Damage, - new Fire_Damage, - new Cold_Damage, - new Lightning_Damage, - new Chaos_Damage, - new Increased_Damage, - new Projectile_Damage, - new Accuracity, - new Accuracy_Rating, - new Damage_Over_Time, - new Movement_Speed + new offence_stats\Attack_Speed, + new offence_stats\Cast_Speed, + new offence_stats\Wands_Damage, + new offence_stats\Physical_Damage, + new offence_stats\Melee_Phys_Damage, + new offence_stats\Attack_Critical_Chance, + new offence_stats\Spells_Critical_Chance, + new offence_stats\Radius_of_Area_Skills, + new offence_stats\Area_Damage, + new offence_stats\Attack_Critical_Multiplier, + new offence_stats\Spell_Critical_Multiplier, + new offence_stats\Spell_Damage, + new offence_stats\Elemental_Damage, + new offence_stats\Weapons_Elemental_Damage, + new offence_stats\Fire_Damage, + new offence_stats\Cold_Damage, + new offence_stats\Lightning_Damage, + new offence_stats\Chaos_Damage, + new offence_stats\Increased_Damage, + new offence_stats\Projectile_Damage, + new offence_stats\Accuracity, + new offence_stats\Accuracy_Rating, + new offence_stats\Damage_Over_Time, ] ]; + + //items + $banItems = ['Flask', 'Weapon2', 'Offhand2']; + if (isset($_GET['offHand'])) { + $banItems = ['Flask', 'Weapon', 'Offhand']; + } + + $items = array_filter($items['items'], function ($item) use (&$banItems) { + return !in_array($item['inventoryId'], $banItems); + }); + + $this->addItems($items); + + //tree + $treeNodesJewels = new CharacterTreePoints; + $nodes = $treeNodesJewels->getPoints($treeData); + $this->addTreeNode($nodes); + + //base stats + $baseStat = new Base_Stats; + $baseStat = $baseStat->getStats($character['level'], $character['classId']); + foreach ($baseStat as $stat) { + $this->addBaseMods($stat); + } + } public function addItems($items) @@ -186,7 +137,7 @@ public function addItems($items) } $this->addAbyssJewels($item); } - + } public function addTreeNode($nodes) @@ -282,7 +233,7 @@ private function getTypeFromIcon($icon) } private function addAbyssJewels($item) - { + { //To Do get all Abyss jewels and creaate TYPE and count them LIKE "Belt Abyssal Socket 1" $countAbys = 0; if (array_key_exists('socketedItems', $item)) { diff --git a/app/Snapshot.php b/app/Snapshot.php new file mode 100644 index 0000000..d3a462b --- /dev/null +++ b/app/Snapshot.php @@ -0,0 +1,51 @@ +attributes['tree_data'] = $tree_data; + } + + public function getTreeDataAttribute($value) + { + // dd($value); + $tree_data = base64_decode($value); + $tree_data = gzuncompress($tree_data); + return json_decode($tree_data, true); + } + + // Item_Data Mutator & Accessor + public function setItemDataAttribute($value) + { + $item_data = gzcompress($value); + $item_data = base64_encode($item_data); + $this->attributes['item_data'] = $item_data; + } + + public function getItemDataAttribute($value) + { + $item_data = base64_decode($value); + $item_data = gzuncompress($item_data); + return json_decode($item_data, true); + } + + public function getStats() + { + // var_dump($this->item_data); + $stManager = new Stats_Manager($this->item_data,$this->tree_data); + return $stManager->getStats(); + } +} diff --git a/config/app.php b/config/app.php index 96000c8..1bac744 100644 --- a/config/app.php +++ b/config/app.php @@ -2,6 +2,12 @@ return [ + /* + | This is seting Caching time in minutes for PoE API + */ + 'poe_cache_time' => env('POE_CACHE_TIME', 4), + + 'poe_leagues' => env('POE_LEAGUES', 'Standard,Hardcore'), /* |-------------------------------------------------------------------------- | Application Name diff --git a/database/migrations/2018_02_25_154245_create_builds_table.php b/database/migrations/2018_02_25_154245_create_builds_table.php index 547ce0e..0ccb6b6 100644 --- a/database/migrations/2018_02_25_154245_create_builds_table.php +++ b/database/migrations/2018_02_25_154245_create_builds_table.php @@ -13,16 +13,23 @@ class CreateBuildsTable extends Migration */ public function up() { - Schema::create('builds', function (Blueprint $table) { + Schema::create('snapshots', function (Blueprint $table) { $table->increments('id'); - $table->string('name'); + $table->string('hash')->unique(); $table->text('tree_data'); $table->text('item_data'); - $table->text('stats')->nullable(); $table->string('poe_version'); + $table->string('original_char')->nullable(); + $table->string('original_level')->nullable(); $table->dateTime('last_visit')->nullable(); $table->timestamps(); }); + + Schema::table('snapshots', function($table) { + $table->index('hash'); + $table->index('original_char'); + }); + } /** @@ -32,6 +39,6 @@ public function up() */ public function down() { - Schema::dropIfExists('saved_builds'); + Schema::dropIfExists('snapshots'); } } diff --git a/resources/assets/js/components/home/ListCharacters.vue b/resources/assets/js/components/home/ListCharacters.vue index 2a96e93..31a2082 100644 --- a/resources/assets/js/components/home/ListCharacters.vue +++ b/resources/assets/js/components/home/ListCharacters.vue @@ -8,7 +8,7 @@ -