Laravel 2019-08-07 21:39

|
zack6849 2019-08-07 21:39:13
$.ajaxSetup({
headers: {
‘X-CSRF-TOKEN’: $(‘meta[name=”csrf-token”]’).attr(‘content’)
}
});
GauravGohil 2019-08-08 10:20:52
hie
GauravGohil 2019-08-08 10:21:08
can i check route parameter and ther route to controller accordingly
GauravGohil 2019-08-08 10:21:09
Route::get(‘builder/{template}’, ‘TemplatesController@show’);
Route::get(‘builder/{savedtemplates}’, ‘SavedTemplatesController@show’);
Aaa 2019-08-08 13:52:30
laravel_discuss-10636.jpg
Can any one help to find this error
I didn’t use auth service provider in this project
2019-08-08 14:02:06
Trying adding ‘driver’ => ‘eloquent’ into the auth.php
Aaa 2019-08-08 14:08:43
2019-08-08 14:02:06
Trying adding ‘driver’ => ‘eloquent’ into the auth.php

laravel_discuss-10638.jpg
Is this correct

2019-08-08 14:11:05
Aaa 2019-08-08 14:08:43
Is this correct

Yeah

Aaa 2019-08-08 14:12:48
But the issue is not solved
2019-08-08 14:13:18
Which version are U using
Aaa 2019-08-08 14:15:23
5.4
2019-08-08 14:16:06
Ok
2019-08-08 14:16:20
Let check thru first then get back
Aaa 2019-08-08 14:19:58
2019-08-08 14:16:20
Let check thru first then get back

Sorry that is 5.5

2019-08-08 14:21:40
Aaa 2019-08-08 14:15:23
5.4

Try this
After adding ‘driver’=>’eloquent’
2. Add ArtisanServiceProvider
IllluminateFoundationProvidersArtisanServiceProvider

Under ‘providers’

3. Then perform composer update

Aaa 2019-08-08 14:37:19
2019-08-08 14:21:40
Try this
After adding ‘driver’=>’eloquent’
2. Add ArtisanServiceProvider
IllluminateFoundationProvidersArtisanServiceProvider

Under ‘providers’

3. Then perform composer update

Done these steps but no change

2019-08-08 14:39:10
Aaa 2019-08-08 14:37:19
Done these steps but no change

Did U add the “::class” at the end of no.2

Aaa 2019-08-08 14:44:31
Yes
2019-08-08 14:47:47
Aaa 2019-08-08 14:44:31
Yes

Then try and comment out the lines you just added before the updates then see what happens

Aaa 2019-08-08 15:38:00
2019-08-08 14:47:47
Then try and comment out the lines you just added before the updates then see what happens

Yap sure

oxbir 2019-08-08 15:44:23
How to find parent_id count?

Users table

public function up()
{
Schema::create(‘users’, function (Blueprint $table) {
$table->bigIncrements(‘id’);
$table->string(‘first_name’);
$table->string(‘last_name’);
$table->string(‘referral_code’)->nullable();
$table->integer(‘parent_id’)->unsigned()->nullable();
$table->string(‘mobile’)->unique();
$table->string(’email’)->unique();
$table->string(‘password’);
$table->rememberToken();
$table->timestamps();
});
}

Order table

public function up()
{
Schema::create(‘oreders’, function (Blueprint $table) {
$table->bigIncrements(‘id’);
$table->bigInteger(‘user_id’)->unsigned();
$table->foreign(‘user_id’)->references(‘id’)->on(‘users’)->onDelete(‘cascade’);
$table->bigInteger(‘product_id’)->unsigned();
$table->foreign(‘product_id’)->references(‘id’)->on(‘products’)->onDelete(‘cascade’);
$table->timestamps();
});
}

My Controller.php

public function index()
{
$orders = Order::with(‘user’)->where(”parent_id)->count();
return $orders;
}

I get this error.

> SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘parent_id’ in ‘where clause’ (SQL: select count(*) as aggregate from orders where exists (select * from users where orders.user_id = users.id`) and `parent_id is null)

yoofi_graham 2019-08-08 15:47:02
oxbir 2019-08-08 15:44:23
How to find parent_id count?

Users table

public function up()
{
Schema::create(‘users’, function (Blueprint $table) {
$table->bigIncrements(‘id’);
$table->string(‘first_name’);
$table->string(‘last_name’);
$table->string(‘referral_code’)->nullable();
$table->integer(‘parent_id’)->unsigned()->nullable();
$table->string(‘mobile’)->unique();
$table->string(’email’)->unique();
$table->string(‘password’);
$table->rememberToken();
$table->timestamps();
});
}

Order table

public function up()
{
Schema::create(‘oreders’, function (Blueprint $table) {
$table->bigIncrements(‘id’);
$table->bigInteger(‘user_id’)->unsigned();
$table->foreign(‘user_id’)->references(‘id’)->on(‘users’)->onDelete(‘cascade’);
$table->bigInteger(‘product_id’)->unsigned();
$table->foreign(‘product_id’)->references(‘id’)->on(‘products’)->onDelete(‘cascade’);
$table->timestamps();
});
}

My Controller.php

public function index()
{
$orders = Order::with(‘user’)->where(”parent_id)->count();
return $orders;
}

I get this error.

> SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘parent_id’ in ‘where clause’ (SQL: select count(*) as aggregate from orders where exists (select * from users where orders.user_id = users.id`) and `parent_id is null)

Try this .. where(“users.parent_id”)

yoofi_graham 2019-08-08 15:47:57
*user.parent_id
ErSoul 2019-08-08 15:58:06
Hello, I have a windows server for testing, running SQL Server 14, Apache and PHP 7.3.

I’m hosting an API laravel project in it, and I’ve configured php/laravel to use SQL Server, so far, the migrations are running, creating objects with tinker works and saves in the DB, but when the VueJS SPA (in the same laravel project) queries the API, the driver throws the following exception:

SQLSTATE[08001]: [Microsoft][ODBC Driver 13 for SQL Server]Client unable to establish connection because an error was encountered during handshakes before login. Common causes include client attempting to connect to an unsupported version of SQL Server, server too busy to accept new connections or a resource limitation (memory or maximum allowed connections) on the server.

I’ve tried with SQLite and everything runs well, but no luck with MSSQL.

ErSoul 2019-08-08 15:58:07
I’ve tried some solutions suggested in google like restarting the MSSQL server, or adding the domain name to the hosts file, but with no luck.
Omid_On11 2019-08-08 17:12:21
Hi guys
Please suggest me good tutorial for VCS and git
amablia 2019-08-08 17:20:51
Did any body work on rental system in laravel
zack6849 2019-08-08 17:22:54
“rental system”?
zack6849 2019-08-08 17:22:58
what are you renting
Harrisdtt 2019-08-08 17:23:13
Hello Every One I encounterd the problem please tell me how to do it.
here is my code style
Harrisdtt 2019-08-08 17:23:13
laravel_discuss-10664.jpg

Harrisdtt 2019-08-08 17:23:14
laravel_discuss-10666.jpg

Harrisdtt 2019-08-08 17:23:14
and it show me with errors shown in below pic
zack6849 2019-08-08 17:25:13
your case isnt right for your backendapi main controller
zack6849 2019-08-08 17:25:20
it should be BackendApi not backendApi
zack6849 2019-08-08 17:25:34
seems pretty self explanatory to me
zack6849 2019-08-08 17:28:14
…did you just… facepalm your own message?
PHP Begginer 2019-08-08 17:34:57
Hi guys .I am running php artisan migrate:fresh —seed . But i get the following error message .
PHP Begginer 2019-08-08 17:35:02
IlluminateDatabaseQueryException : SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table product_categories add constraint `
product_categories_category_id_foreign` foreign key (category_id) references categories (id))
PHP Begginer 2019-08-08 17:35:12
laravel_discuss-10674.jpg

PHP Begginer 2019-08-08 17:35:43
is it because of laravel 5.8
zack6849 2019-08-08 17:35:53
try making them bigintegers maybe
zack6849 2019-08-08 17:36:12
it looks like the types (whatever they may be) don’t match between the columns
zack6849 2019-08-08 17:36:29
i’d say because you’re using bigIncrements for the ids they should be bigintegers for the foreign keys
PHP Begginer 2019-08-08 17:38:06
Let me try
PHP Begginer 2019-08-08 17:38:14
This is what i get
PHP Begginer 2019-08-08 17:38:17
Base table or view already exists: 1050 Table ‘product_categories’ already exists (SQL: create table `product
_categories` (id bigint unsigned not null auto_increment primary key, category_id bigint unsigned not null, product_id bigint unsigned not null) default characte
r set utf8mb4 collate ‘utf8mb4_unicode_ci’)
zack6849 2019-08-08 17:38:37
did you just seed, or migrate:fresh —seed?
PHP Begginer 2019-08-08 17:39:05
migrate:fresh —seed
PHP Begginer 2019-08-08 17:39:19
php artisan migrate:fresh —seed
|