This commit is contained in:
Ludovic CANDELLIER
2021-04-08 16:18:21 +02:00
parent 8ec6f24df4
commit 098a46f3a0
19 changed files with 313 additions and 14 deletions

View File

@@ -0,0 +1,132 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Botanic\Family;
use App\Models\Botanic\Genre;
use App\Models\Botanic\Specie;
use App\Models\Botanic\Variety;
class checkdb extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'checkdb';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Consistency from old version';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$varieties = Variety::whereNull('specie_id')->get();
foreach ($varieties as $variety) {
$specie_name = trim($variety->specie_name);
/*
$specie = Specie::firstOrCreate(['name' => $specie_name]);
if ($specie) {
$variety->specie_id = $specie->id;
$variety->save();
}
*/
dump($specie_name);
}
/*
$species = Specie::all();
foreach ($species as $specie) {
$specie->name = trim($specie->name);
$specie->save();
}
$varieties = Variety::all();
foreach ($varieties as $variety) {
$variety->name = trim($variety->name);
$variety->save();
}
*/
/*
$varieties = Variety::all();
foreach ($varieties as $variety) {
$specie_name = $variety->specie;
dump($specie_name);
if (!empty($specie_name)) {
$specie = Specie::byName($specie_name)->first();
if (isset($specie->name))
{
dump($specie->name);
$variety->specie_id = $specie->id;
$variety->save();
} else {
dump("non trouvé");
}
} else {
dump("Aucune espèce");
}
}
*/
/*
$species = Specie::all();
foreach ($species as $specie) {
$genre_name = $specie->genre;
dump($genre_name);
if (!empty($genre_name)) {
$genre = Genre::byName($genre_name)->first();
if (isset($genre->name))
{
dump($genre->name);
$specie->genre_id = $genre->id;
$specie->save();
} else {
dump("non trouvé");
}
} else {
dump("Aucun genre");
}
}
*/
/*
$genres = Genre::all();
foreach ($genres as $genre) {
$family_name = $genre->family;
dump($family_name);
if (!empty($family_name)) {
$family = Family::byName($family_name)->first();
if (isset($family->name))
{
dump($family->name);
$genre->family_id = $family->id;
$genre->save();
} else {
dump("non trouvé");
}
} else {
dump("Aucune famille");
}
}
*/
}
}

View File

@@ -0,0 +1,117 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Botanic\Family;
use App\Models\Botanic\Genre;
use App\Models\Botanic\Specie;
use App\Models\Botanic\Variety;
class migrate extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'create_relation';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Migration from old version';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$species = Specie::all();
foreach ($species as $specie) {
$specie->name = trim($specie->name);
$specie->save();
}
$varieties = Variety::all();
foreach ($varieties as $variety) {
$variety->name = trim($variety->name);
$variety->save();
}
/*
$varieties = Variety::all();
foreach ($varieties as $variety) {
$specie_name = $variety->specie;
dump($specie_name);
if (!empty($specie_name)) {
$specie = Specie::byName($specie_name)->first();
if (isset($specie->name))
{
dump($specie->name);
$variety->specie_id = $specie->id;
$variety->save();
} else {
dump("non trouvé");
}
} else {
dump("Aucune espèce");
}
}
*/
/*
$species = Specie::all();
foreach ($species as $specie) {
$genre_name = $specie->genre;
dump($genre_name);
if (!empty($genre_name)) {
$genre = Genre::byName($genre_name)->first();
if (isset($genre->name))
{
dump($genre->name);
$specie->genre_id = $genre->id;
$specie->save();
} else {
dump("non trouvé");
}
} else {
dump("Aucun genre");
}
}
*/
/*
$genres = Genre::all();
foreach ($genres as $genre) {
$family_name = $genre->family;
dump($family_name);
if (!empty($family_name)) {
$family = Family::byName($family_name)->first();
if (isset($family->name))
{
dump($family->name);
$genre->family_id = $family->id;
$genre->save();
} else {
dump("non trouvé");
}
} else {
dump("Aucune famille");
}
}
*/
}
}

View File

@@ -6,7 +6,7 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Botanic\Families;
use App\DataTables\Botanic\FamiliesDataTable;
use App\Datatables\Botanic\FamiliesDataTable;
class FamilyController extends Controller
{

View File

@@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use App\Repositories\Botanic\Genres;
use App\Repositories\Botanic\Families;
use App\DataTables\Botanic\GenresDataTable;
use App\Datatables\Botanic\GenresDataTable;
class GenreController extends Controller
{

View File

@@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use App\Repositories\Botanic\Species;
use App\Repositories\Botanic\Genres;
use App\DataTables\Botanic\SpeciesDataTable;
use App\Datatables\Botanic\SpeciesDataTable;
class SpecieController extends Controller
{

View File

@@ -8,7 +8,7 @@ use App\Http\Controllers\Controller;
use App\Repositories\Botanic\Varieties;
use App\Repositories\Botanic\Species;
use App\Repositories\Shop\TagGroups;
use App\DataTables\Botanic\VarietiesDataTable;
use App\Datatables\Botanic\VarietiesDataTable;
use App\Models\Shop\Variety;

View File

@@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use App\Repositories\Shop\Articles;
use App\Repositories\Shop\ArticleFamilies;
use App\DataTables\Shop\ArticlesDataTable;
use App\Datatables\Shop\ArticlesDataTable;
class ArticleController extends Controller
{

View File

@@ -6,7 +6,7 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\ArticleFamilies;
use App\DataTables\Shop\ArticleFamiliesDataTable;
use App\Datatables\Shop\ArticleFamiliesDataTable;
class ArticleFamilyController extends Controller
{

View File

@@ -6,7 +6,7 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\Categories;
use App\DataTables\Shop\CategoriesDataTable;
use App\Datatables\Shop\CategoriesDataTable;
class CategoryController extends Controller
{

View File

@@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use App\Repositories\Shop\ArticleFamilies;
use App\Repositories\Shop\Packages;
use App\DataTables\Shop\PackagesDataTable;
use App\Datatables\Shop\PackagesDataTable;
class PackageController extends Controller
{

View File

@@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use App\Repositories\Shop\ArticleFamilies;
use App\Repositories\Shop\PriceGenericCategories;
use App\DataTables\Shop\PriceGenericCategoriesDataTable;
use App\Datatables\Shop\PriceGenericCategoriesDataTable;
class PriceGenericCategoryController extends Controller
{

View File

@@ -11,7 +11,7 @@ use App\Repositories\Shop\PriceGenericCategories;
use App\Repositories\Shop\Taxes;
use App\Repositories\Shop\Packages;
use App\Repositories\Shop\Unities;
use App\DataTables\Shop\PriceGenericsDataTable;
use App\Datatables\Shop\PriceGenericsDataTable;
class PriceGenericController extends Controller
{

View File

@@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use App\Repositories\Shop\Tags;
use App\Repositories\Shop\TagGroups;
use App\DataTables\Shop\TagsDataTable;
use App\Datatables\Shop\TagsDataTable;
class TagController extends Controller
{

View File

@@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use App\Repositories\Shop\TagGroups;
use App\Repositories\Shop\ArticleFamilies;
use App\DataTables\Shop\TagGroupsDataTable;
use App\Datatables\Shop\TagGroupsDataTable;
class TagGroupController extends Controller
{

View File

@@ -8,7 +8,7 @@ use App\Http\Controllers\Controller;
use App\Repositories\Shop\ArticleFamilies;
use App\Repositories\Shop\Packages;
use App\Repositories\Shop\Unities;
use App\DataTables\Shop\UnitiesDataTable;
use App\Datatables\Shop\UnitiesDataTable;
class UnityController extends Controller
{

View File

@@ -6,7 +6,7 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\Categories;
use App\DataTables\Shop\CategoriesDataTable;
use App\Datatables\Shop\CategoriesDataTable;
class CategoryController extends Controller
{

View File

@@ -15,6 +15,7 @@
"awssat/laravel-sync-migration": "^0.1",
"barryvdh/laravel-dompdf": "^0.8.6",
"barryvdh/laravel-snappy": "^0.4.7",
"beyondcode/laravel-comments": "^1.2",
"box/spout": "^3.1",
"browner12/helpers": "^3.0",
"coduo/php-humanizer": "^3.0",

18
config/comments.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
return [
/*
* The comment class that should be used to store and retrieve
* the comments.
*/
'comment_class' => \BeyondCode\Comments\Comment::class,
/*
* The user model that should be used when associating comments with
* commentators. If null, the default user provider from your
* Laravel authentication configuration will be used.
*/
'user_model' => null,
];

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommentsTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->morphs('commentable');
$table->text('comment');
$table->boolean('is_approved')->default(false);
$table->unsignedBigInteger('user_id')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::dropIfExists('comments');
}
}