What is the problem in changing the file position?

|
Siberfx 2020-05-06 16:56:07
post/{:any}
Siberfx 2020-05-06 16:56:13
you forget there a “/”
Siberfx 2020-05-06 16:56:40
you are still doing not correct anyway
Siberfx 2020-05-06 16:57:05
you querrying in controller the passed varriable only as “int” but you send by router any.
Siberfx 2020-05-06 16:57:41
send in route as /post/{id}
2020-05-06 16:58:32
ok sir
2020-05-06 17:00:30
you are so helpful❀
Siberfx 2020-05-06 17:01:06
these are very basic stuffs, please read some the documentation of laravel
2020-05-06 17:04:05
okay sure
rijisoft 2020-05-06 17:19:17
http://game4.baifumeiba.com/minigame/ydygdy/

Anyone have source Code of this game?

PHP Begginer 2020-05-06 17:24:45
Hi Guys , can someone assist please , I have the table in my database already but when i try to migrate i get the following error msg Base table or view not found: 1146 Table ‘portifolio.post_tag’ doesn’t exist
Siberfx 2020-05-06 17:25:53
code ?
PHP Begginer 2020-05-06 17:25:54
public function run()
{
$this->call(UsersTableSeeder::class);
$this->call(PostsTableSeeder::class);
$this->call(TagsTableSeeder::class);

//TODO join tags and posts

$posts = Post::all();

Tag::get()->each(function ($tag) use ($posts){
$tag->posts()->attach($posts->pluck(‘id’));
});
}

PHP Begginer 2020-05-06 17:26:15
*/
public function up()
{
Schema::create(‘posts_tags’, function (Blueprint $table) {
$table->id();
$table->BigInteger(‘posts_id’);
$table->BigInteger(‘tags_id’);
$table->timestamps();
});
}
PHP Begginer 2020-05-06 17:26:19
*/
public function up()
{
Schema::create(‘posts_tags’, function (Blueprint $table) {
$table->id();
$table->BigInteger(‘posts_id’);
$table->BigInteger(‘tags_id’);
$table->timestamps();
});
}
PHP Begginer 2020-05-06 17:26:32
protected $table = ‘tags’;

public function posts()
{
return $this->belongsToMany(Post::class);
}

PHP Begginer 2020-05-06 17:26:46
public function tags()
{
return $this->belongsToMany(Tag::class);
}
PHP Begginer 2020-05-06 17:27:06
The above is my code
Siberfx 2020-05-06 17:28:45
can you please try again after “composer dump-autoload”
Siberfx 2020-05-06 17:29:15
and did you use migrate ?
PHP Begginer 2020-05-06 17:29:58
I have done that still the same problem
PHP Begginer 2020-05-06 17:32:49
Siberfx 2020-05-06 17:28:45
can you please try again after “composer dump-autoload”

i have done dump autoload still I am getting the same error

Siberfx 2020-05-06 17:33:10
do you know debugging ?
Siberfx 2020-05-06 17:33:57
$posts = Post::all();

Tag::get()->each(function ($tag) use ($posts){
dd($tag, $posts);
$tag->posts()->attach($posts->pluck(‘id’));
});

PHP Begginer 2020-05-06 17:34:49
yes I now
PHP Begginer 2020-05-06 17:36:12
laravel_discuss-36111.jpg

Begroups 2020-05-06 17:51:16
How to do pagination for this type of list when i load data by ajax
Begroups 2020-05-06 17:51:28
laravel_discuss-36113.jpg

Lucas 2020-05-06 18:14:27
local.ERROR: Declaration of CarbonTranslator::setLocale($locale) must be compatible with SymfonyContractsTranslationLocaleAwareInterface::setLocale(string $locale) {“exception”:”[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Declaration of Carbon\Translator::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale) at /home1/contr724/public_html/transferencia.unisecal.edu.br/vendor/nesbot/carbon/src/Carbon/Translator.php:18)
[stacktrace]
Lucas 2020-05-06 18:14:40
Anybody with the same error?
Developer_124 2020-05-06 19:51:02
Shivi:
Anyone know how to make the website fast

Actually my website has data upto lakhs

So the page load very slowly

????? I have used Vue is as frontend and code igniter as backend

DesolatorMagno 2020-05-06 19:56:51
Check the slower part of the website and try to fix it, there is no golden rule for it.
gharakeshishyan 2020-05-06 20:18:41
create table notification … done (time: 0.036s)
> add foreign key FK_notific_id: notification (notification_id) references notification (id) …Exception: SQLSTATE[HY000]: General error: 3780 Referencing column ‘notification_id’ and referenced column ‘id’ in foreign key constraint ‘FK_notific_id’ are incompatible.
gharakeshishyan 2020-05-06 20:19:28
how i can fix this error without change migrate file position
themanojyadav 2020-05-06 20:44:01
gharakeshishyan 2020-05-06 20:19:28
how i can fix this error without change migrate file position

What is the problem in changing the file position?

gharakeshishyan 2020-05-06 21:01:56
@themanojyadav I can change the position of the file, but I know there is another option
cayetanohosma 2020-05-06 21:55:06
I have a couple of migration files, and I try to run them I get the following error:
IlluminateDatabaseQueryException : SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation “users” already exists (SQL: create table “users” (“id” uuid not null, “firstname” varchar(100) not null, “lastname” varchar(200) null, “email” varchar(200) not null, “company_id” uuid not null, “username” varchar(200) not null, “password” varchar(255) not null, “email_verified_at” timestamp(0) without time zone null, “remember_token” varchar(255) not null, “created_at” timestamp(0) with time zone null, “updated_at” timestamp(0) with time zone null, “deleted_at” timestamp(0) with time zone null))

And My migration are the following
<?php

use IlluminateDatabaseMigrationsMigration;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;

class Users extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(‘users’, function (Blueprint $table) {

$table->uuid(‘id’)->primary();
$table->string(‘firstname’, 100);
$table->string(‘lastname’, 200)->nullable();
$table->string(’email’, 200)->unique();
$table->uuid(‘company_id’);
$table->string(‘username’, 200)->unique();
$table->string(‘password’, 255);
$table->dateTime(’email_verified_at’)->nullable();
$table->string(‘remember_token’, 255);
$table->timestampsTz();
$table->softDeletesTz();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists(‘users’);
}
}

cayetanohosma 2020-05-06 21:57:19
Anu Cliue?
Siberfx 2020-05-06 22:02:06
cayetanohosma 2020-05-06 21:55:06
I have a couple of migration files, and I try to run them I get the following error:
IlluminateDatabaseQueryException : SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation “users” already exists (SQL: create table “users” (“id” uuid not null, “firstname” varchar(100) not null, “lastname” varchar(200) null, “email” varchar(200) not null, “company_id” uuid not null, “username” varchar(200) not null, “password” varchar(255) not null, “email_verified_at” timestamp(0) without time zone null, “remember_token” varchar(255) not null, “created_at” timestamp(0) with time zone null, “updated_at” timestamp(0) with time zone null, “deleted_at” timestamp(0) with time zone null))

And My migration are the following
<?php

use IlluminateDatabaseMigrationsMigration;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;

class Users extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(‘users’, function (Blueprint $table) {

$table->uuid(‘id’)->primary();
$table->string(‘firstname’, 100);
$table->string(‘lastname’, 200)->nullable();
$table->string(’email’, 200)->unique();
$table->uuid(‘company_id’);
$table->string(‘username’, 200)->unique();
$table->string(‘password’, 255);
$table->dateTime(’email_verified_at’)->nullable();
$table->string(‘remember_token’, 255);
$table->timestampsTz();
$table->softDeletesTz();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists(‘users’);
}
}

if you dont have data on your tables, try to do php artisan migrate:fresh

Siberfx 2020-05-06 22:02:22
because even if it fails during the migration, it creates some of the tables
Siberfx 2020-05-06 22:02:27
but not doing rollback himself
cayetanohosma 2020-05-06 22:02:48
I got it! @Siberfx I forgot that my migrations are inside a package and Larevel by default has an users table… πŸ€¦β€β™‚οΈ
Christopher 2020-05-06 22:03:58
All it’s okay with this App ?
Siberfx 2020-05-06 22:05:09
instead of overriding, you can modify the missing fields of the packages migration file (for users table) and go for it
cayetanohosma 2020-05-06 22:13:00
@Siberfx What about this error:
Invalid foreign key: 7 ERROR: there is no unique constraint matching given keys for referenced table “user_actions” (SQL: alter table “group_policies” add constraint “fk_action_id” foreign key (“action_id”) references “user_actions” (“id”))

the user_actions migration is:
class UserActions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(‘user_actions’, function (Blueprint $table) {
$table->uuid(‘id’);
$table->string(‘name’, 100);
$table->string(‘description’, 200);
$table->timestamps();
$table->softDeletes();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists(‘user_actions’);
}
}
and the group_policies migration file is, the following, where the error appears:
class GroupPolicies extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(‘group_policies’, function (Blueprint $table) {
$table->uuid(‘id’);
$table->uuid(‘group_id’);
$table->uuid(‘resource_id’);
$table->uuid(‘action_id’);
$table->timestamps();
$table->softDeletes();

$table->foreign(‘group_id’, ‘fk_group_id’)
->references(‘id’)
->on(‘groups’);

$table->foreign(‘action_id’, ‘fk_action_id’)
->references(‘id’)
->on(‘user_actions’);

$table->index(
[‘group_id’, ‘resource_id’,’action_id’],
‘group_resource_action_idx’
);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table(‘group_policies’, function (Blueprint $table) {
$table->dropForeign(‘group_id’);
$table->dropForeign(‘action_id’);
});

Schema::dropIfExists(‘group_policies’);
}
}

Siberfx 2020-05-06 22:14:53
cayetanohosma 2020-05-06 22:13:00
@Siberfx What about this error:
Invalid foreign key: 7 ERROR: there is no unique constraint matching given keys for referenced table “user_actions” (SQL: alter table “group_policies” add constraint “fk_action_id” foreign key (“action_id”) references “user_actions” (“id”))

the user_actions migration is:
class UserActions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(‘user_actions’, function (Blueprint $table) {
$table->uuid(‘id’);
$table->string(‘name’, 100);
$table->string(‘description’, 200);
$table->timestamps();
$table->softDeletes();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists(‘user_actions’);
}
}
and the group_policies migration file is, the following, where the error appears:
class GroupPolicies extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(‘group_policies’, function (Blueprint $table) {
$table->uuid(‘id’);
$table->uuid(‘group_id’);
$table->uuid(‘resource_id’);
$table->uuid(‘action_id’);
$table->timestamps();
$table->softDeletes();

$table->foreign(‘group_id’, ‘fk_group_id’)
->references(‘id’)
->on(‘groups’);

$table->foreign(‘action_id’, ‘fk_action_id’)
->references(‘id’)
->on(‘user_actions’);

$table->index(
[‘group_id’, ‘resource_id’,’action_id’],
‘group_resource_action_idx’
);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table(‘group_policies’, function (Blueprint $table) {
$table->dropForeign(‘group_id’);
$table->dropForeign(‘action_id’);
});

Schema::dropIfExists(‘group_policies’);
}
}

which package is it and for what I am interested πŸ™‚

cayetanohosma 2020-05-06 22:15:30
It’s my own package, I’m writting this one as first one… actually I’m learning about the packages πŸ˜‰
Siberfx 2020-05-06 22:16:07
why do you need so many uuid ?
cayetanohosma 2020-05-06 22:17:02
cause I think that is more stable and it can grow without issues
Siberfx 2020-05-06 22:17:34
if it fits your requirements, thats ok
|