-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
790 additions
and
2,055 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Jobs\ProcessCelebrities; | ||
use App\Jobs\ProcessCountryOfOrigin; | ||
use App\Jobs\ProcessElficTraits; | ||
use App\Jobs\ProcessKlingonName; | ||
use App\Jobs\ProcessLitteratureReferences; | ||
use App\Jobs\ProcessMainCaracteristics; | ||
use App\Jobs\ProcessMixte; | ||
use App\Jobs\ProcessOrigins; | ||
use App\Jobs\ProcessPersonality; | ||
use App\Jobs\ProcessSimilarNames; | ||
use App\Jobs\ProcessSyllabes; | ||
use App\Models\Characteristic; | ||
use App\Models\Name; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Str; | ||
|
||
class CreateMainCharacteristics extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'openname:create-main-characteristics'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Command description'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle(): void | ||
{ | ||
foreach (Name::orderBy('total', 'desc')->lazy() as $name) { | ||
|
||
if (is_null($name->characteristics)) { | ||
continue; | ||
} | ||
|
||
$strings = explode(',', $name->characteristics); | ||
foreach ($strings as $string) { | ||
// lowercase | ||
$lowercase = Str::lower($string); | ||
|
||
// remove the space at the beginning and the end | ||
$string = Str::of($lowercase)->trim()->__toString(); | ||
|
||
// remove any comma or dot at the end | ||
$string = Str::of($string)->rtrim(',.')->__toString(); | ||
|
||
// count the number of words and skip the word if there is more than 1 | ||
$words = explode(' ', $string); | ||
if (count($words) > 1) { | ||
continue; | ||
} | ||
|
||
$characteristic = Characteristic::firstOrCreate([ | ||
'name' => $string, | ||
]); | ||
|
||
$name->mainCharacteristics()->syncWithoutDetaching([$characteristic->id]); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\ViewModels\Home\HomeViewModel; | ||
use App\Http\ViewModels\Search\SearchViewModel; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Cache; | ||
use Illuminate\View\View; | ||
|
||
class SearchController extends Controller | ||
{ | ||
public function index(): View | ||
{ | ||
$stats = Cache::remember('stats', 604800, function () { | ||
return HomeViewModel::serverStats(); | ||
}); | ||
|
||
return view('search.index', [ | ||
'stats' => $stats, | ||
'names' => SearchViewModel::names(), | ||
]); | ||
} | ||
|
||
public function post(Request $request): View | ||
{ | ||
$stats = Cache::remember('stats', 604800, function () { | ||
return HomeViewModel::serverStats(); | ||
}); | ||
|
||
$term = trim($request->input('term')); | ||
$names = SearchViewModel::names($term); | ||
dd($names); | ||
return view('search.index', [ | ||
'stats' => $stats, | ||
'names' => $names, | ||
'term' => $term, | ||
]); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
app/Http/Controllers/Settings/SettingsProfileController.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.