vsmov 1.0.0
This commit is contained in:
30
database/factories/ActorFactory.php
Normal file
30
database/factories/ActorFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vsmov\Core\Models\Actor;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ActorFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Actor::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $name = $this->faker->name,
|
||||
'slug' => Str::slug($name),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
database/factories/CategoryFactory.php
Normal file
30
database/factories/CategoryFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vsmov\Core\Models\Category;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CategoryFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Category::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $name = $this->faker->name,
|
||||
'slug' => Str::slug($name),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
database/factories/DirectorFactory.php
Normal file
30
database/factories/DirectorFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vsmov\Core\Models\Director;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DirectorFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Director::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $name = $this->faker->name,
|
||||
'slug' => Str::slug($name),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
database/factories/EpisodeFactory.php
Normal file
30
database/factories/EpisodeFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vsmov\Core\Models\Episode;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class EpisodeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Episode::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $name = rand(1, 5),
|
||||
'slug' => Str::slug('tap-' . $name),
|
||||
];
|
||||
}
|
||||
}
|
||||
31
database/factories/MovieFactory.php
Normal file
31
database/factories/MovieFactory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vsmov\Core\Models\Movie;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class MovieFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Movie::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $name = $this->faker->name,
|
||||
'origin_name' => $name,
|
||||
'slug' => Str::slug($name.microtime(true)),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
database/factories/RegionFactory.php
Normal file
30
database/factories/RegionFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vsmov\Core\Models\Region;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class RegionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Region::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $name = $this->faker->name,
|
||||
'slug' => Str::slug($name),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
database/factories/StudioFactory.php
Normal file
30
database/factories/StudioFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vsmov\Core\Models\Studio;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class StudioFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Studio::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $name = $this->faker->name,
|
||||
'slug' => Str::slug($name),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
database/factories/TagFactory.php
Normal file
30
database/factories/TagFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vsmov\Core\Models\Tag;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class TagFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Tag::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $name = $this->faker->name,
|
||||
'slug' => Str::slug($name),
|
||||
];
|
||||
}
|
||||
}
|
||||
39
database/migrations/2015_08_04_131614_create_menus_table.php
Normal file
39
database/migrations/2015_08_04_131614_create_menus_table.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMenusTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('menus', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name', 100);
|
||||
$table->string('type', 20)->nullable();
|
||||
$table->string('link', 255)->nullable();
|
||||
$table->integer('parent_id')->unsigned()->nullable();
|
||||
$table->integer('lft')->unsigned()->nullable();
|
||||
$table->integer('rgt')->unsigned()->nullable();
|
||||
$table->integer('depth')->unsigned()->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('menus');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateSettingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('key')->unique();
|
||||
$table->string('name');
|
||||
$table->string('description')->nullable();
|
||||
$table->text('value')->nullable();
|
||||
$table->text('field');
|
||||
$table->string('group')->nullable()->index();
|
||||
$table->boolean('active')->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['group', 'active']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class RemoveBackpackuserModel extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// establish the table names
|
||||
$model_has_roles = config('permission.table_names.model_has_roles');
|
||||
$model_has_permissions = config('permission.table_names.model_has_permissions');
|
||||
|
||||
// replace the BackpackUser model with User
|
||||
if (\Illuminate\Support\Facades\Schema::hasTable($model_has_roles)) {
|
||||
$this->replaceModels($model_has_roles);
|
||||
}
|
||||
if (\Illuminate\Support\Facades\Schema::hasTable($model_has_permissions)) {
|
||||
$this->replaceModels($model_has_permissions);
|
||||
}
|
||||
}
|
||||
|
||||
public function replaceModels($table_name)
|
||||
{
|
||||
Log::info('Replacing BackpackUser model in '.$table_name);
|
||||
|
||||
// if you've ended up with duplicate entries (both for App\User and App\Models\BackpackUser)
|
||||
// we can just delete them
|
||||
$userEntries = DB::table($table_name)
|
||||
->where('model_type', "App\User")
|
||||
->get();
|
||||
|
||||
foreach ($userEntries as $entry) {
|
||||
DB::table($table_name)
|
||||
->where('role_id', $entry->role_id)
|
||||
->where('model_type', 'App\Models\BackpackUser')
|
||||
->where('model_id', $entry->model_id)
|
||||
->delete();
|
||||
}
|
||||
|
||||
// for the rest of them, we can just replace the BackpackUser model with User
|
||||
DB::table($table_name)
|
||||
->where('model_type', "App\Models\BackpackUser")
|
||||
->update([
|
||||
'model_type' => "App\User",
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateThemesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('themes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->index();
|
||||
$table->string('display_name');
|
||||
$table->string('preview_image')->nullable();
|
||||
$table->string('author');
|
||||
$table->string('package_name');
|
||||
$table->text('value')->nullable();
|
||||
$table->boolean('active')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('themes');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Spatie\Permission\PermissionRegistrar;
|
||||
|
||||
class CreatePermissionTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$teams = config('permission.teams');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([PermissionRegistrar::$pivotPermission, PermissionRegistrar::$pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCategoriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('categories', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name')->unique();
|
||||
$table->string('slug')->unique()->index();
|
||||
$table->string('seo_title')->nullable();
|
||||
$table->string('seo_des')->nullable();
|
||||
$table->string('seo_key')->nullable();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index();
|
||||
$table->string('user_name')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('categories');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateActorsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('actors', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name_md5')->unique();
|
||||
$table->string('slug')->index();
|
||||
$table->enum('gender', ['male', 'female', 'other'])->nullable();
|
||||
$table->string('bio')->nullable();
|
||||
$table->string('thumb_url', 2048)->nullable();
|
||||
$table->string('seo_title')->nullable();
|
||||
$table->string('seo_des')->nullable();
|
||||
$table->string('seo_key')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('actors');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateDirectorsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('directors', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name_md5')->unique();
|
||||
$table->string('slug')->index();
|
||||
$table->enum('gender', ['male', 'female', 'other'])->nullable();
|
||||
$table->string('bio')->nullable();
|
||||
$table->string('thumb_url', 2048)->nullable();
|
||||
$table->string('seo_title')->nullable();
|
||||
$table->string('seo_des')->nullable();
|
||||
$table->string('seo_key')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('directors');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regions', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name')->unique();
|
||||
$table->string('slug')->unique()->index();
|
||||
$table->string('seo_title')->nullable();
|
||||
$table->string('seo_des')->nullable();
|
||||
$table->string('seo_key')->nullable();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index();
|
||||
$table->string('user_name')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regions');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateStudiosTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('studios', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name_md5')->unique();
|
||||
$table->string('slug')->index();
|
||||
$table->string('thumb_url', 2048)->nullable();
|
||||
$table->string('seo_title')->nullable();
|
||||
$table->string('seo_des')->nullable();
|
||||
$table->string('seo_key')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('studios');
|
||||
}
|
||||
}
|
||||
37
database/migrations/2022_07_10_153517_create_tags_table.php
Normal file
37
database/migrations/2022_07_10_153517_create_tags_table.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTagsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name_md5')->unique();
|
||||
$table->string('slug')->index();
|
||||
$table->string('seo_title')->nullable();
|
||||
$table->string('seo_des')->nullable();
|
||||
$table->string('seo_key')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tags');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMoviesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('movies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 1024);
|
||||
$table->string('origin_name', 1024);
|
||||
$table->string('slug')->unique();
|
||||
$table->text('content')->nullable();
|
||||
$table->string('thumb_url', 2048)->nullable();
|
||||
$table->string('poster_url', 2048)->nullable();
|
||||
$table->enum('type', ['single', 'series']);
|
||||
$table->enum('status', ['trailer', 'ongoing', 'completed']);
|
||||
$table->string('trailer_url', 2048)->nullable();
|
||||
$table->string('episode_time')->nullable();
|
||||
$table->string('episode_current')->nullable();
|
||||
$table->string('episode_total')->nullable();
|
||||
$table->string('quality')->nullable()->default('HD');
|
||||
$table->string('language')->nullable()->default('Vietsub');
|
||||
$table->string('notify', 512)->nullable();
|
||||
$table->string('showtimes', 512)->nullable();
|
||||
$table->integer('publish_year')->index()->nullable();
|
||||
$table->boolean('is_shown_in_theater')->default(false);
|
||||
$table->boolean('is_recommended')->default(false);
|
||||
$table->boolean('is_copyright')->default(false);
|
||||
$table->boolean('is_sensitive_content')->default(false);
|
||||
|
||||
$table->integer('episode_server_count')->default(0);
|
||||
$table->integer('episode_data_count')->default(0);
|
||||
|
||||
$table->integer('view_total')->default(0);
|
||||
$table->integer('view_day')->default(0);
|
||||
$table->integer('view_week')->default(0);
|
||||
$table->integer('view_month')->default(0);
|
||||
$table->integer('rating_count')->default(0);
|
||||
$table->decimal('rating_star', 3, 1)->default(0);
|
||||
|
||||
$table->string('update_handler', 1024)->nullable();
|
||||
$table->string('update_identity', 2048)->nullable();
|
||||
$table->string('update_checksum', 2048)->nullable();
|
||||
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index();
|
||||
$table->string('user_name')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('movies');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateEpisodesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('episodes', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
|
||||
$table->unsignedBigInteger('movie_id')->index();
|
||||
$table->foreign('movie_id')->references('id')->on('movies')->onDelete('cascade');
|
||||
|
||||
$table->string('server');
|
||||
$table->string('name');
|
||||
$table->string('slug');
|
||||
$table->string('type');
|
||||
$table->string('link')->nullable();
|
||||
$table->boolean('has_report')->default(false);
|
||||
$table->string('report_message', 512)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['movie_id', 'slug']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('episodes');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateActorMovieTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('actor_movie', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('movie_id')->index();
|
||||
$table->foreign('movie_id')->references('id')->on('movies')->onDelete('cascade');
|
||||
|
||||
$table->unsignedBigInteger('actor_id')->index();
|
||||
$table->foreign('actor_id')->references('id')->on('actors')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('actor_movie');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCategoryMovieTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('category_movie', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('movie_id')->index();
|
||||
$table->foreign('movie_id')->references('id')->on('movies')->onDelete('cascade');
|
||||
|
||||
$table->unsignedBigInteger('category_id')->index();
|
||||
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('category_movie');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateDirectorMovieTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('director_movie', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('movie_id')->index();
|
||||
$table->foreign('movie_id')->references('id')->on('movies')->onDelete('cascade');
|
||||
|
||||
$table->unsignedBigInteger('director_id')->index();
|
||||
$table->foreign('director_id')->references('id')->on('directors')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('director_movie');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMovieRegionTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('movie_region', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('movie_id')->index();
|
||||
$table->foreign('movie_id')->references('id')->on('movies')->onDelete('cascade');
|
||||
|
||||
$table->unsignedBigInteger('region_id')->index();
|
||||
$table->foreign('region_id')->references('id')->on('regions')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('movie_region');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMovieStudioTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('movie_studio', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('movie_id')->index();
|
||||
$table->foreign('movie_id')->references('id')->on('movies')->onDelete('cascade');
|
||||
|
||||
$table->unsignedBigInteger('studio_id')->index();
|
||||
$table->foreign('studio_id')->references('id')->on('studios')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('movie_studio');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMovieTagTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('movie_tag', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('movie_id')->index();
|
||||
$table->foreign('movie_id')->references('id')->on('movies')->onDelete('cascade');
|
||||
|
||||
$table->unsignedBigInteger('tag_id')->index();
|
||||
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('movie_tag');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCatalogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('catalogs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->string('slug')->unique()->index();
|
||||
$table->integer('paginate')->default(20);
|
||||
$table->string('value')->nullable();
|
||||
$table->string('seo_title')->nullable();
|
||||
$table->string('seo_des')->nullable();
|
||||
$table->string('seo_key')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('catalogs');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AddFulltextIndexToMovies extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement('ALTER TABLE movies ADD FULLTEXT search_index (name, origin_name)');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::statement('ALTER TABLE movies DROP INDEX search_index');
|
||||
}
|
||||
}
|
||||
59
database/seeders/CatalogsTableSeeder.php
Normal file
59
database/seeders/CatalogsTableSeeder.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Vsmov\Core\Models\Catalog;
|
||||
|
||||
class CatalogsTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds_
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$catalogs = [
|
||||
[
|
||||
'name' => 'Phim mới',
|
||||
'slug' => 'phim-moi',
|
||||
'paginate' => 20,
|
||||
'value' => '|is_copyright|0|updated_at|desc',
|
||||
'seo_title' => 'Title Phim mới',
|
||||
'seo_des' => 'Des Phim mới',
|
||||
'seo_key' => 'Key Phim mới',
|
||||
],
|
||||
[
|
||||
'name' => 'Phim bộ',
|
||||
'slug' => 'phim-bo',
|
||||
'paginate' => 20,
|
||||
'value' => '|type|series|updated_at|desc',
|
||||
'seo_title' => 'Title Phim bộ',
|
||||
'seo_des' => 'Des Phim bộ',
|
||||
'seo_key' => 'Key Phim bộ',
|
||||
],
|
||||
[
|
||||
'name' => 'Phim lẻ',
|
||||
'slug' => 'phim-le',
|
||||
'paginate' => 20,
|
||||
'value' => '|type|single|updated_at|desc',
|
||||
'seo_title' => 'Title Phim lẻ',
|
||||
'seo_des' => 'Des Phim lẻ',
|
||||
'seo_key' => 'Key Phim lẻ',
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($catalogs as $index => $catalog) {
|
||||
$result = Catalog::firstOrCreate(collect($catalog)->only('slug')->toArray(), collect($catalog)->except('slug')->toArray());
|
||||
|
||||
if (!$result) {
|
||||
$this->command->info("Insert failed at record $index");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
121
database/seeders/CategoriesTableSeeder.php
Normal file
121
database/seeders/CategoriesTableSeeder.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Vsmov\Core\Models\Category;
|
||||
|
||||
class CategoriesTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$categories = [
|
||||
[
|
||||
"name" => "Hành Động",
|
||||
"slug" => "hanh-dong",
|
||||
],
|
||||
[
|
||||
"name" => "Tình Cảm",
|
||||
"slug" => "tinh-cam",
|
||||
],
|
||||
[
|
||||
"name" => "Hài Hước",
|
||||
"slug" => "hai-huoc",
|
||||
],
|
||||
[
|
||||
"name" => "Cổ Trang",
|
||||
"slug" => "co-trang",
|
||||
],
|
||||
[
|
||||
"name" => "Tâm Lý",
|
||||
"slug" => "tam-ly",
|
||||
],
|
||||
[
|
||||
"name" => "Hình Sự",
|
||||
"slug" => "hinh-su",
|
||||
],
|
||||
[
|
||||
"name" => "Chiến Tranh",
|
||||
"slug" => "chien-tranh",
|
||||
],
|
||||
[
|
||||
"name" => "Thể Thao",
|
||||
"slug" => "the-thao",
|
||||
],
|
||||
[
|
||||
"name" => "Võ Thuật",
|
||||
"slug" => "vo-thuat",
|
||||
],
|
||||
[
|
||||
"name" => "Viễn Tưởng",
|
||||
"slug" => "vien-tuong",
|
||||
],
|
||||
[
|
||||
"name" => "Phiêu Lưu",
|
||||
"slug" => "phieu-luu",
|
||||
],
|
||||
[
|
||||
"name" => "Khoa Học",
|
||||
"slug" => "khoa-hoc",
|
||||
],
|
||||
[
|
||||
"name" => "Kinh Dị",
|
||||
"slug" => "kinh-di",
|
||||
],
|
||||
[
|
||||
"name" => "Âm Nhạc",
|
||||
"slug" => "am-nhac",
|
||||
],
|
||||
[
|
||||
"name" => "Thần Thoại",
|
||||
"slug" => "than-thoai",
|
||||
],
|
||||
[
|
||||
"name" => "Tài Liệu",
|
||||
"slug" => "tai-lieu",
|
||||
],
|
||||
[
|
||||
"name" => "Gia Đình",
|
||||
"slug" => "gia-dinh",
|
||||
],
|
||||
[
|
||||
"name" => "Chính kịch",
|
||||
"slug" => "chinh-kich",
|
||||
],
|
||||
[
|
||||
"name" => "Bí ẩn",
|
||||
"slug" => "bi-an",
|
||||
],
|
||||
[
|
||||
"name" => "Học Đường",
|
||||
"slug" => "hoc-duong",
|
||||
],
|
||||
[
|
||||
"name" => "Kinh Điển",
|
||||
"slug" => "kinh-dien",
|
||||
],
|
||||
[
|
||||
"name" => "Phim 18+",
|
||||
"slug" => "phim-18",
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($categories as $index => $category) {
|
||||
$result = Category::updateOrCreate($category);
|
||||
|
||||
if (!$result) {
|
||||
$this->command->info("Insert failed at record $index.");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$this->command->info('Inserted ' . count($categories) . ' categories.');
|
||||
}
|
||||
}
|
||||
48
database/seeders/MenusTableSeeder.php
Normal file
48
database/seeders/MenusTableSeeder.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Seeders;
|
||||
|
||||
use Backpack\Settings\app\Models\Setting;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Vsmov\Core\Models\Category;
|
||||
use Vsmov\Core\Models\Menu;
|
||||
use Vsmov\Core\Models\Region;
|
||||
use Vsmov\Core\Models\Catalog;
|
||||
use Vsmov\Core\Models\Theme;
|
||||
|
||||
class MenusTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$homeMenu = Menu::firstOrCreate(['name' => 'Trang chủ', 'link' => '/', 'type' => 'internal_link']);
|
||||
$categoryGroup = Menu::firstOrCreate(['name' => 'Thể loại', 'link' => '#', 'type' => 'internal_link']);
|
||||
$categories = Category::all();
|
||||
foreach ($categories as $category) {
|
||||
Menu::updateOrCreate([
|
||||
'name' => $category->name,
|
||||
], [
|
||||
'link' => $category->getUrl(false),
|
||||
'type' => 'internal_link',
|
||||
'parent_id' => $categoryGroup->id
|
||||
]);
|
||||
}
|
||||
|
||||
$regionGroup = Menu::firstOrCreate(['name' => 'Quốc gia', 'link' => '#', 'type' => 'internal_link']);
|
||||
$regions = Region::all();
|
||||
foreach ($regions as $region) {
|
||||
Menu::updateOrCreate([
|
||||
'name' => $region->name,
|
||||
], [
|
||||
'link' => $region->getUrl(false),
|
||||
'type' => 'internal_link',
|
||||
'parent_id' => $regionGroup->id
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
98
database/seeders/PermissionsSeeder.php
Normal file
98
database/seeders/PermissionsSeeder.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Backpack\PermissionManager\app\Models\Permission;
|
||||
use Backpack\PermissionManager\app\Models\Role;
|
||||
|
||||
class PermissionsSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$permissions = [
|
||||
'Browse actor',
|
||||
'Create actor',
|
||||
'Update actor',
|
||||
'Delete actor',
|
||||
'Browse director',
|
||||
'Create director',
|
||||
'Update director',
|
||||
'Delete director',
|
||||
'Browse tag',
|
||||
'Create tag',
|
||||
'Update tag',
|
||||
'Delete tag',
|
||||
'Browse studio',
|
||||
'Create studio',
|
||||
'Update studio',
|
||||
'Delete studio',
|
||||
'Browse catalog',
|
||||
'Create catalog',
|
||||
'Update catalog',
|
||||
'Delete catalog',
|
||||
'Browse category',
|
||||
'Create category',
|
||||
'Update category',
|
||||
'Delete category',
|
||||
'Browse region',
|
||||
'Create region',
|
||||
'Update region',
|
||||
'Delete region',
|
||||
'Browse crawl schedule',
|
||||
'Create crawl schedule',
|
||||
'Update crawl schedule',
|
||||
'Delete crawl schedule',
|
||||
'Browse movie',
|
||||
'Create movie',
|
||||
'Update movie',
|
||||
'Delete movie',
|
||||
'Browse user',
|
||||
'Create user',
|
||||
'Update user',
|
||||
'Delete user',
|
||||
'Browse role',
|
||||
'Create role',
|
||||
'Update role',
|
||||
'Delete role',
|
||||
'Browse permission',
|
||||
'Create permission',
|
||||
'Update permission',
|
||||
'Delete permission',
|
||||
'Browse episode',
|
||||
'Create episode',
|
||||
'Update episode',
|
||||
'Delete episode',
|
||||
'Browse menu',
|
||||
'Create menu',
|
||||
'Update menu',
|
||||
'Delete menu',
|
||||
'Delete menu item',
|
||||
'Browse plugin',
|
||||
'Update plugin',
|
||||
'Customize theme',
|
||||
];
|
||||
|
||||
$admin = Role::firstOrCreate(['name' => "Admin", 'guard_name' => 'backpack']);
|
||||
foreach ($permissions as $index => $permission) {
|
||||
$result = Permission::firstOrCreate([
|
||||
'name' => $permission,
|
||||
'guard_name' => 'backpack'
|
||||
]);
|
||||
|
||||
$admin->givePermissionTo($permission);
|
||||
|
||||
if (!$result) {
|
||||
$this->command->info("Insert failed at record $index.");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
174
database/seeders/RegionsTableSeeder.php
Normal file
174
database/seeders/RegionsTableSeeder.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Vsmov\Core\Models\Category;
|
||||
use Vsmov\Core\Models\Region;
|
||||
|
||||
class RegionsTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$regions = [
|
||||
[
|
||||
"name" => "Trung Quốc",
|
||||
"slug" => "trung-quoc",
|
||||
],
|
||||
[
|
||||
"name" => "Hàn Quốc",
|
||||
"slug" => "han-quoc",
|
||||
],
|
||||
[
|
||||
"name" => "Nhật Bản",
|
||||
"slug" => "nhat-ban",
|
||||
],
|
||||
[
|
||||
"name" => "Thái Lan",
|
||||
"slug" => "thai-lan",
|
||||
],
|
||||
[
|
||||
"name" => "Âu Mỹ",
|
||||
"slug" => "au-my",
|
||||
],
|
||||
[
|
||||
"name" => "Đài Loan",
|
||||
"slug" => "dai-loan",
|
||||
],
|
||||
[
|
||||
"name" => "Hồng Kông",
|
||||
"slug" => "hong-kong",
|
||||
],
|
||||
[
|
||||
"name" => "Ấn Độ",
|
||||
"slug" => "an-do",
|
||||
],
|
||||
[
|
||||
"name" => "Anh",
|
||||
"slug" => "anh",
|
||||
],
|
||||
[
|
||||
"name" => "Pháp",
|
||||
"slug" => "phap",
|
||||
],
|
||||
[
|
||||
"name" => "Canada",
|
||||
"slug" => "canada",
|
||||
],
|
||||
[
|
||||
"name" => "Quốc Gia Khác",
|
||||
"slug" => "quoc-gia-khac",
|
||||
],
|
||||
[
|
||||
"name" => "Đức",
|
||||
"slug" => "duc",
|
||||
],
|
||||
[
|
||||
"name" => "Tây Ban Nha",
|
||||
"slug" => "tay-ban-nha",
|
||||
],
|
||||
[
|
||||
"name" => "Thổ Nhĩ Kỳ",
|
||||
"slug" => "tho-nhi-ky",
|
||||
],
|
||||
[
|
||||
"name" => "Hà Lan",
|
||||
"slug" => "ha-lan",
|
||||
],
|
||||
[
|
||||
"name" => "Indonesia",
|
||||
"slug" => "indonesia",
|
||||
],
|
||||
[
|
||||
"name" => "Nga",
|
||||
"slug" => "nga",
|
||||
],
|
||||
[
|
||||
"name" => "Mexico",
|
||||
"slug" => "mexico",
|
||||
],
|
||||
[
|
||||
"name" => "Ba lan",
|
||||
"slug" => "ba-lan",
|
||||
],
|
||||
[
|
||||
"name" => "Úc",
|
||||
"slug" => "uc",
|
||||
],
|
||||
[
|
||||
"name" => "Thụy Điển",
|
||||
"slug" => "thuy-dien",
|
||||
],
|
||||
[
|
||||
"name" => "Malaysia",
|
||||
"slug" => "malaysia",
|
||||
],
|
||||
[
|
||||
"name" => "Brazil",
|
||||
"slug" => "brazil",
|
||||
],
|
||||
[
|
||||
"name" => "Philippines",
|
||||
"slug" => "philippines",
|
||||
],
|
||||
[
|
||||
"name" => "Bồ Đào Nha",
|
||||
"slug" => "bo-dao-nha",
|
||||
],
|
||||
[
|
||||
"name" => "Ý",
|
||||
"slug" => "y",
|
||||
],
|
||||
[
|
||||
"name" => "Đan Mạch",
|
||||
"slug" => "dan-mach",
|
||||
],
|
||||
[
|
||||
"name" => "UAE",
|
||||
"slug" => "uae",
|
||||
],
|
||||
[
|
||||
"name" => "Na Uy",
|
||||
"slug" => "na-uy",
|
||||
],
|
||||
[
|
||||
"name" => "Thụy Sĩ",
|
||||
"slug" => "thuy-si",
|
||||
],
|
||||
[
|
||||
"name" => "Châu Phi",
|
||||
"slug" => "chau-phi",
|
||||
],
|
||||
[
|
||||
"name" => "Nam Phi",
|
||||
"slug" => "nam-phi",
|
||||
],
|
||||
[
|
||||
"name" => "Ukraina",
|
||||
"slug" => "ukraina",
|
||||
],
|
||||
[
|
||||
"name" => "Ả Rập Xê Út",
|
||||
"slug" => "a-rap-xe-ut",
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($regions as $index => $region) {
|
||||
$result = Region::updateOrCreate($region);
|
||||
|
||||
if (!$result) {
|
||||
$this->command->info("Insert failed at record $index.");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$this->command->info('Inserted ' . count($regions) . ' regions.');
|
||||
}
|
||||
}
|
||||
733
database/seeders/SettingsTableSeeder.php
Normal file
733
database/seeders/SettingsTableSeeder.php
Normal file
@@ -0,0 +1,733 @@
|
||||
<?php
|
||||
|
||||
namespace Vsmov\Core\Database\Seeders;
|
||||
|
||||
use Backpack\Settings\app\Models\Setting;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SettingsTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds_
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$generals = [
|
||||
[
|
||||
'key' => 'site_cache_ttl',
|
||||
'name' => 'Thời gian lưu cache',
|
||||
'description' => 'site_cache_ttl',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'giây (s)',
|
||||
]),
|
||||
'value' => 60,
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_brand',
|
||||
'description' => 'site_brand',
|
||||
'name' => 'Site Brand',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'textarea',
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_logo',
|
||||
'description' => 'site_logo',
|
||||
'name' => 'Site Logo',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'textarea',
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_image_proxy_url',
|
||||
'description' => 'site_image_proxy_url',
|
||||
'name' => 'Cấu hình proxy',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => '{image_url}: biến hình ảnh'
|
||||
]),
|
||||
'value' => 'https://images2-focus-opensocial.googleusercontent.com/gadgets/proxy?container=focus&refresh=604800&url={image_url}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_image_proxy_enable',
|
||||
'description' => 'site_image_proxy_enable',
|
||||
'name' => 'Sử dụng Proxy cho đường dẫn hình ảnh',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'switch',
|
||||
'label' => 'Use proxy link in image path',
|
||||
'color' => 'primary', // May be any bootstrap color class or an hex color
|
||||
'onLabel' => '✓',
|
||||
'offLabel' => '✕'
|
||||
]),
|
||||
'active' => 0,
|
||||
]
|
||||
];
|
||||
|
||||
$metas = [
|
||||
[
|
||||
'key' => 'site_meta_siteName',
|
||||
'description' => 'site_meta_siteName',
|
||||
'name' => 'Meta site name',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'tab' => 'General'
|
||||
]),
|
||||
'value' => 'Vsmov.COM',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_meta_shortcut_icon',
|
||||
'description' => 'site_meta_shortcut_icon',
|
||||
'name' => 'Meta shortcut icon',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'ckfinder',
|
||||
'tab' => 'General'
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_homepage_title',
|
||||
'description' => 'site_homepage_title',
|
||||
'name' => 'Tiêu đề mặc định',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'tab' => 'General'
|
||||
]),
|
||||
'value' => 'Phim hay mới cập nhật 2022',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_meta_description',
|
||||
'description' => 'site_meta_description',
|
||||
'name' => 'Meta description',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'textarea',
|
||||
'tab' => 'General'
|
||||
]),
|
||||
'value' => 'Vsmov.COM',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_meta_keywords',
|
||||
'description' => 'site_meta_keywords',
|
||||
'name' => 'Meta keywords',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'textarea',
|
||||
'tab' => 'General'
|
||||
]),
|
||||
'value' => 'Vsmov.COM',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_meta_image',
|
||||
'description' => 'site_meta_image',
|
||||
'name' => 'Meta image',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'ckfinder',
|
||||
'tab' => 'General'
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_meta_head_tags',
|
||||
'description' => 'site_meta_head_tags',
|
||||
'name' => 'Head meta tags',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'textarea',
|
||||
'tab' => 'General',
|
||||
'attributes' => [
|
||||
'rows' => 5
|
||||
],
|
||||
]),
|
||||
'value' => <<<EOT
|
||||
<meta charSet="utf-8" />
|
||||
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
|
||||
<meta name="robots" content="index,follow" />
|
||||
<meta name="revisit-after" content="1 days" />
|
||||
<meta name="ROBOTS" content="index,follow" />
|
||||
<meta name="googlebot" content="index,follow" />
|
||||
<meta name="BingBOT" content="index,follow" />
|
||||
<meta name="yahooBOT" content="index,follow" />
|
||||
<meta name="slurp" content="index,follow" />
|
||||
<meta name="msnbot" content="index,follow" />
|
||||
EOT,
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_movie_title',
|
||||
'description' => 'site_movie_title',
|
||||
'name' => 'Mẫu tiêu đề trang thông tin phim',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin phim: {name}|{origin_name}|{language}|{quality}|{episode_current}|{publish_year}|...',
|
||||
'tab' => 'Phim'
|
||||
]),
|
||||
'value' => 'Phim {name}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_episode_watch_title',
|
||||
'description' => 'site_episode_watch_title',
|
||||
'name' => 'Mẫu tiêu đề trang xem phim',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin phim: {movie.name}|{movie.origin_name}|{movie.language}|{movie.quality}|{movie.episode_current}|movie.publish_year}|...<br />Thông tin tập: {name}',
|
||||
'tab' => 'Phim'
|
||||
]),
|
||||
'value' => 'Xem phim {movie.name} tập {name} {movie.language} {movie.quality}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_category_title',
|
||||
'description' => 'site_category_title',
|
||||
'name' => 'Tiêu đề thể loại mặc định',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Thể Loại'
|
||||
]),
|
||||
'value' => 'Danh sách phim {name} - tổng hợp phim {name}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_category_des',
|
||||
'description' => 'site_category_des',
|
||||
'name' => 'Description thể loại mặc định',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Thể Loại'
|
||||
]),
|
||||
'value' => 'Phim {name} mới nhất tuyển chọn hay nhất. Top những bộ phim {name} đáng để bạn cày 2022',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_category_key',
|
||||
'description' => 'site_category_key',
|
||||
'name' => 'Keywords thể loại mặc định',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Thể Loại'
|
||||
]),
|
||||
'value' => 'Xem phim {name},Phim {name} mới,Phim {name} 2022,phim hay',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_region_title',
|
||||
'description' => 'site_region_title',
|
||||
'name' => 'Tiêu đề quốc gia mặc định',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Quốc Gia'
|
||||
]),
|
||||
'value' => 'Danh sách phim {name} - tổng hợp phim {name}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_region_des',
|
||||
'description' => 'site_region_des',
|
||||
'name' => 'Description quốc gia mặc định',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Quốc Gia'
|
||||
]),
|
||||
'value' => 'Phim {name} mới nhất tuyển chọn hay nhất. Top những bộ phim {name} đáng để bạn cày 2022',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_region_key',
|
||||
'description' => 'site_region_key',
|
||||
'name' => 'Keywords quốc gia mặc định',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Quốc Gia'
|
||||
]),
|
||||
'value' => 'Xem phim {name},Phim {name} mới,Phim {name} 2022,phim hay',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_studio_title',
|
||||
'description' => 'site_studio_title',
|
||||
'name' => 'Tiêu đề studio',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Studio'
|
||||
]),
|
||||
'value' => 'Danh sách phim {name} - tổng hợp phim {name}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_studio_des',
|
||||
'description' => 'site_studio_des',
|
||||
'name' => 'Description studio',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Studio'
|
||||
]),
|
||||
'value' => 'Phim {name} mới nhất tuyển chọn hay nhất. Top những bộ phim {name} đáng để bạn cày 2022',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_studio_key',
|
||||
'description' => 'site_studio_key',
|
||||
'name' => 'Keywords studio',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Studio'
|
||||
]),
|
||||
'value' => 'Xem phim {name},Phim {name} mới,Phim {name} 2022,phim hay',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_actor_title',
|
||||
'description' => 'site_actor_title',
|
||||
'name' => 'Tiêu đề diễn viên',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Diễn Viên'
|
||||
]),
|
||||
'value' => 'Phim của diễn viên {name} - tổng hợp phim {name} hay nhất',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_actor_des',
|
||||
'description' => 'site_actor_des',
|
||||
'name' => 'Description diễn viên',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Diễn Viên'
|
||||
]),
|
||||
'value' => 'Phim của diễn viên {name} - tổng hợp phim {name} hay nhất',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_actor_key',
|
||||
'description' => 'site_actor_key',
|
||||
'name' => 'Keywords diễn viên',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Diễn Viên'
|
||||
]),
|
||||
'value' => 'xem phim {name},phim {name},tuyen tap phim {name}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_director_title',
|
||||
'description' => 'site_director_title',
|
||||
'name' => 'Tiêu đề đạo diễn',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Đạo Diễn'
|
||||
]),
|
||||
'value' => 'Phim của đạo diễn {name} - tổng hợp phim {name} hay nhất',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_director_des',
|
||||
'description' => 'site_director_des',
|
||||
'name' => 'Description đạo diễn',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Đạo Diễn'
|
||||
]),
|
||||
'value' => 'Phim của đạo diễn {name} - tổng hợp phim {name} hay nhất',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_director_key',
|
||||
'description' => 'site_director_key',
|
||||
'name' => 'Keywords đạo diễn',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Đạo Diễn'
|
||||
]),
|
||||
'value' => 'xem phim {name},phim {name},tuyen tap phim {name}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_tag_title',
|
||||
'description' => 'site_tag_title',
|
||||
'name' => 'Tiêu đề tag',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Tag'
|
||||
]),
|
||||
'value' => 'Phim {name} vietsub - phim {name} full hd',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_tag_des',
|
||||
'description' => 'site_tag_des',
|
||||
'name' => 'Description tag',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Tag'
|
||||
]),
|
||||
'value' => 'Phim {name} vietsub - phim {name} full hd',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_tag_key',
|
||||
'description' => 'site_tag_key',
|
||||
'name' => 'Keywords tag',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => 'Thông tin: {name}',
|
||||
'tab' => 'Tag'
|
||||
]),
|
||||
'value' => 'xem phim {name},phim {name},{name} vietsub',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_routes_movie',
|
||||
'description' => 'site_routes_movie',
|
||||
'name' => 'Trang thông tin phim',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => '<span class="text-danger">{movie}, {id}</span> Buộc phải có ít nhất 1 param',
|
||||
'tab' => 'Slug'
|
||||
]),
|
||||
'value' => '/phim/{movie}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_routes_episode',
|
||||
'description' => 'site_routes_episode',
|
||||
'name' => 'Trang xem phim',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => <<<EOT
|
||||
<span class="text-danger">{movie}, {movie_id}</span> Ít nhất 1<br />
|
||||
<span class="text-danger">{episode}, {id}</span> Bắt buộc<br />
|
||||
EOT,
|
||||
'tab' => 'Slug'
|
||||
]),
|
||||
'value' => '/phim/{movie}/{episode}-{id}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_routes_category',
|
||||
'description' => 'site_routes_category',
|
||||
'name' => 'Trang thể loại',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => <<<EOT
|
||||
<span class="text-danger">{category}, {id}</span> Ít nhất 1
|
||||
EOT,
|
||||
'tab' => 'Slug'
|
||||
]),
|
||||
'value' => '/the-loai/{category}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_routes_region',
|
||||
'description' => 'site_routes_region',
|
||||
'name' => 'Trang quốc gia',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => <<<EOT
|
||||
<span class="text-danger">{region}, {id}</span> Ít nhất 1
|
||||
EOT,
|
||||
'tab' => 'Slug'
|
||||
]),
|
||||
'value' => '/quoc-gia/{region}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_routes_tag',
|
||||
'description' => 'site_routes_tag',
|
||||
'name' => 'Trang từ khóa',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => <<<EOT
|
||||
<span class="text-danger">{tag}, {id}</span> Ít nhất 1
|
||||
EOT,
|
||||
'tab' => 'Slug'
|
||||
]),
|
||||
'value' => '/tu-khoa/{tag}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_routes_types',
|
||||
'description' => 'site_routes_types',
|
||||
'name' => 'Trang danh sách phim',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => <<<EOT
|
||||
<span class="text-danger">{type}, {id}</span> Ít nhất 1
|
||||
EOT,
|
||||
'tab' => 'Slug'
|
||||
]),
|
||||
'value' => '/danh-sach/{type}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_routes_actors',
|
||||
'description' => 'site_routes_actors',
|
||||
'name' => 'Trang danh diễn viên',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => <<<EOT
|
||||
<span class="text-danger">{actor}, {id}</span> Ít nhất 1
|
||||
EOT,
|
||||
'tab' => 'Slug'
|
||||
]),
|
||||
'value' => '/dien-vien/{actor}',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_routes_directors',
|
||||
'description' => 'site_routes_directors',
|
||||
'name' => 'Trang danh đạo diễn',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
'hint' => <<<EOT
|
||||
<span class="text-danger">{director}, {id}</span> Ít nhất 1
|
||||
EOT,
|
||||
'tab' => 'Slug'
|
||||
]),
|
||||
'value' => '/dao-dien/{director}',
|
||||
'active' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$players = [
|
||||
[
|
||||
'key' => 'jwplayer_license',
|
||||
'description' => 'jwplayer_license',
|
||||
'name' => 'Jwplayer license',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
]),
|
||||
'value' => 'ITWMv7t88JGzI0xPwW8I0+LveiXX9SWbfdmt0ArUSyc=',
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'jwplayer_logo_file',
|
||||
'description' => 'jwplayer_logo_file',
|
||||
'name' => 'Jwplayer logo image',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'ckfinder',
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'jwplayer_logo_link',
|
||||
'description' => 'jwplayer_logo_link',
|
||||
'name' => 'Jwplayer logo link',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'jwplayer_logo_position',
|
||||
'description' => 'jwplayer_logo_position',
|
||||
'name' => 'Jwplayer logo position',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'select_from_array',
|
||||
'options' => [
|
||||
'top-left' => 'Top left',
|
||||
'top-right' => 'Top right',
|
||||
'bottom-right' => 'Bottom right',
|
||||
'bottom-left' => 'Bottom left',
|
||||
'control-bar' => 'Control bar',
|
||||
]
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'jwplayer_advertising_file',
|
||||
'description' => 'jwplayer_advertising_file',
|
||||
'name' => 'Jwplayer advertising vast file',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'ckfinder',
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'jwplayer_advertising_skipoffset',
|
||||
'description' => 'jwplayer_advertising_skipoffset',
|
||||
'name' => 'Jwplayer advertising skipoffset',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'number',
|
||||
'hint' => 'giây'
|
||||
]),
|
||||
'value' => 5,
|
||||
'active' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$systems = [
|
||||
[
|
||||
'key' => 'site_theme',
|
||||
'name' => 'Theme',
|
||||
'description' => 'site_theme',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'view',
|
||||
'view' => 'themes::selector'
|
||||
]),
|
||||
'value' => 'default',
|
||||
'active' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$others = [
|
||||
[
|
||||
'key' => 'social_facebook_app_id',
|
||||
'description' => 'social_facebook_app_id',
|
||||
'name' => 'Facebook App ID',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'text',
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_scripts_facebook_sdk',
|
||||
'description' => 'site_scripts_facebook_sdk',
|
||||
'name' => 'Facebook JS SDK script tag',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'code',
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
[
|
||||
'key' => 'site_scripts_google_analytics',
|
||||
'description' => 'site_scripts_google_analytics',
|
||||
'name' => 'Google analytics script tag',
|
||||
'field' => json_encode([
|
||||
'name' => 'value',
|
||||
'type' => 'code',
|
||||
]),
|
||||
'active' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($systems as $index => $setting) {
|
||||
$result = Setting::firstOrCreate(collect($setting)->only('key')->toArray(), collect($setting)->except('key')->toArray());
|
||||
|
||||
if (!$result) {
|
||||
$this->command->info("Insert failed at record $index");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($generals as $index => $setting) {
|
||||
$result = Setting::firstOrCreate(collect($setting)->only('key')->toArray(), collect($setting)
|
||||
->merge(['group' => 'generals'])->except('key')->toArray());
|
||||
|
||||
if (!$result) {
|
||||
$this->command->info("Insert failed at record $index");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($metas as $index => $setting) {
|
||||
$result = Setting::firstOrCreate(collect($setting)->only('key')->toArray(), collect($setting)->merge(['group' => 'metas'])->except('key')->toArray());
|
||||
|
||||
if (!$result) {
|
||||
$this->command->info("Insert failed at record $index");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($players as $index => $setting) {
|
||||
$result = Setting::firstOrCreate(collect($setting)->only('key')->toArray(), collect($setting)->merge(['group' => 'jwplayer'])->except('key')->toArray());
|
||||
|
||||
if (!$result) {
|
||||
$this->command->info("Insert failed at record $index");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($others as $index => $setting) {
|
||||
$result = Setting::firstOrCreate(collect($setting)->only('key')->toArray(), collect($setting)->merge(['group' => 'others'])->except('key')->toArray());
|
||||
|
||||
if (!$result) {
|
||||
$this->command->info("Insert failed at record $index");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete key not using
|
||||
$all_settings = array_merge($generals, $metas, $players, $systems, $others);
|
||||
$all_settings = array_map( function( $a ) { return $a['key']; }, $all_settings );
|
||||
Setting::whereIn('group', ['generals', 'metas', 'players', 'systems', 'others'])->whereNotIn('key', $all_settings)->delete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user