If you want an array of items that will only change through code changes then you can do this with a simple config file. For instance, in your example of states, make a file states.php in the config folder and then put in it;
<?php
return [
'NY','NJ','CA'....
];
Then in a view,
@foreach(config('states') as $state)
<option>{{ $state }}</option>
@endforeach
and in validation use the in rule and pass the config element.
But, if you want a user to be able to change these lists of values then a user interface could be built to modify the spatie value store. This is where there are maybe a list of choices that the user decides.
Suppose you were building a HR system, you might start with a list of 'types' such as 'Manager', 'Supervisor', 'Developer' etc as a get them started type list. But then the user of the system wants to add new job types. They should be able to do this without coming to you to edit the code. You could create a table for this, or you could store it in the valuestore.
If you hold that valuestore in code then when you deploy an updated version of the application you could easily overwrite the user's modified list with your base list.
This is why I mentioned seeding or Migrations.
Migrations are just a script that runs only when you ask for it, and hopefully not twice. Just as you might push rows into the database after building the tables, you could do the same for valuestore.
A migration created like php artisan make:migration == create_job_types --create=whatever will contain;
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateJobTypes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('whatever', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
}
You can put whatever code you like in the up() and down() methods, eg
public function up()
{
$valuestore = Valuestore::make($pathToFile);
$valuestore->put(['jobtypes' => [
'Director',
'Manager',
'Supervisor',
'Developer',
],
]);
}
The benefit of this is that if you redeploy to a new server, you can run php artisan migrate:fresh and have the value store initiated.