Can tinker show the result in a table form?

|
SM_NHosseini 2019-10-14 13:30:03
$media_owner_ODM_Provinces = Province::whereHas(‘media’)->with([‘county’ => function ($query) {
$query->whereHas(‘county_media’);
}])->get()->toArray();
SM_NHosseini 2019-10-14 13:30:17
laravel_discuss-15322.jpg

Mhd_keramati 2019-10-14 13:30:24
laravel_discuss-15323.jpg

SM_NHosseini 2019-10-14 13:30:58
but I want to check if there is $province_id in request body then this condition apply to the query :
SM_NHosseini 2019-10-14 13:31:18
laravel_discuss-15325.jpg

SM_NHosseini 2019-10-14 13:31:56
which it would be like this in final:
SM_NHosseini 2019-10-14 13:31:57
laravel_discuss-15327.jpg

SM_NHosseini 2019-10-14 13:32:30
but the problem is the first query will return all provinces’s with their countirs,
SM_NHosseini 2019-10-14 13:33:23
but when I put the second condition in it, it just return the counties that has giveng province_id
SM_NHosseini 2019-10-14 13:33:42
which it’s ok if i send province_id in the request.
SM_NHosseini 2019-10-14 13:34:14
but when $province_id is null it just return provinces without their counties.
SM_NHosseini 2019-10-14 13:34:19
any sugeestion?
SM_NHosseini 2019-10-14 14:36:52
SM_NHosseini 2019-10-14 13:34:19
any sugeestion?

i find the solution. if anyone is interesed let me know

DesolatorMagno 2019-10-14 16:14:51
SM_NHosseini 2019-10-14 13:34:19
any sugeestion?

You can check the value and build 2 query.

DesolatorMagno 2019-10-14 16:15:39
I’m the documentation should be a very similar example.
cabdoulhamid 2019-10-14 16:29:52
What are you trying to do?
DesolatorMagno 2019-10-14 16:32:08
If it worked it would be the error.
DesolatorMagno 2019-10-14 16:32:51
You can’t access delete or update using a link, they are put and delete and the link would access the get.
cabdoulhamid 2019-10-14 16:34:17
You can try to perform the delete by the article _id
DesolatorMagno 2019-10-14 16:35:23
Use a form, in the documentation should be examples.
DesolatorMagno 2019-10-14 16:36:15
You can either use a form or Ajax, that’s basically yours options.
DesolatorMagno 2019-10-14 16:37:53
I am quite sure that in the documentation is a example of doing it, search in front – blade, with luck is there.
cabdoulhamid 2019-10-14 16:46:45
cabdoulhamid 2019-10-14 16:34:17
You can try to perform the delete by the article _id

Route::delete(‘article/{id}’, ArticleController@destroy);

Look at this link,

Nested Resource Controllers and Routes: Laravel CRUD Example

Nested Resource Controllers and Routes: Laravel CRUD Example – Laravel DailyLaravel Daily
When building CRUD-like projects, sometimes you want some items be accessible only with their parent, for example in countries-cities relationships, you don’t want to list all the cities in the world, but only by country, like /countries/123/cities, where 123 is country_id. This article will show you how to do it, using Route::resource() and usual CRUD controllers.
razaririr 2019-10-14 16:50:06
The Process class relies on proc_open, which is not available on your PHP installation.
testbottttttt123 2019-10-14 20:40:58
anyone know to implement grant type Authorization Code with dusterio/lumen-passport?
MatPk 2019-10-14 21:06:11
“`IlluminateDatabaseQueryException : SQLSTATE[HY000]: General error: 1813 Tablespace for table ‘laravideo.migrations’ exists. Please DISCARD the tablespace before IMPORT (SQL: create table migrations (id int unsigned not null auto_increment primary key, migration varchar(191) not null, batch int not null) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)“`
MatPk 2019-10-14 21:06:44
what is the problem?
behzadaminnima 2019-10-14 21:07:06
MatPk 2019-10-14 21:06:11
“`IlluminateDatabaseQueryException : SQLSTATE[HY000]: General error: 1813 Tablespace for table ‘laravideo.migrations’ exists. Please DISCARD the tablespace before IMPORT (SQL: create table migrations (id int unsigned not null auto_increment primary key, migration varchar(191) not null, batch int not null) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)“`

جدولتو حذف کن اول
تو دیتابیست جدول با این اسم هست

cabdoulhamid 2019-10-14 21:08:43
MatPk 2019-10-14 21:06:11
“`IlluminateDatabaseQueryException : SQLSTATE[HY000]: General error: 1813 Tablespace for table ‘laravideo.migrations’ exists. Please DISCARD the tablespace before IMPORT (SQL: create table migrations (id int unsigned not null auto_increment primary key, migration varchar(191) not null, batch int not null) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)“`

You’re trying to create a table that already exists.
Refresh (drop all tables) your database and refresh migration.

MatPk 2019-10-14 21:08:47
behzadaminnima 2019-10-14 21:07:06
جدولتو حذف کن اول
تو دیتابیست جدول با این اسم هست

dadash inja bayad eng be chati
+ hich jadvali nist

MatPk 2019-10-14 21:09:20
cabdoulhamid 2019-10-14 21:08:43
You’re trying to create a table that already exists.
Refresh (drop all tables) your database and refresh migration.

i used php artisan migrate:fresh but still show’s me error

behzadaminnima 2019-10-14 21:09:26
MatPk 2019-10-14 21:08:47
dadash inja bayad eng be chati
+ hich jadvali nist

😂😂
hast ye negah daghigh koni mibini

cabdoulhamid 2019-10-14 21:10:22
MatPk 2019-10-14 21:09:20
i used php artisan migrate:fresh but still show’s me error

It won’t be work. Do like I said. You manually drop all existing tables in database and execute artisan migrate

MatPk 2019-10-14 21:10:48
behzadaminnima 2019-10-14 21:09:26
😂😂
hast ye negah daghigh koni mibini

laravel_discuss-15388.jpg

MatPk 2019-10-14 21:21:48
wich file? sorry i don’t undrestand
MatPk 2019-10-14 21:28:34
so should i delete all the same files?
cabdoulhamid 2019-10-14 21:30:53
Create new database then to continue right now… 😅
You’ll always have time to search for solutions on Google.
Mar R. 2019-10-15 06:07:54
laravel_discuss-15408.jpg

Mar R. 2019-10-15 06:07:54
Developers Sr.Net and PHP 100% remote position applicants only Bogotá, Colombia skype contact: marrivera.73
Mar R. 2019-10-15 06:07:55
laravel_discuss-15409.jpg

H_Bakhtar 2019-10-15 08:31:14
Hi guys! what is the problem of this error errno: 150 “Foreign key constraint is incorrectly formed
skys215 2019-10-15 08:38:47
It seems like a database problem
skys215 2019-10-15 08:39:19
or find this error message in the vendor folder
and check the if statement beofre it
H_Bakhtar 2019-10-15 09:00:37
laravel_discuss-15414.jpg
this is the problem
H_Bakhtar 2019-10-15 09:00:38
laravel_discuss-15415.jpg

skys215 2019-10-15 09:28:09
I think it’s maybe you didn’t create compnies table yet?
skys215 2019-10-15 09:28:38
H_Bakhtar 2019-10-15 09:00:38

I can’t see companies table creating

cabdoulhamid 2019-10-15 09:43:40
H_Bakhtar 2019-10-15 09:00:38

You must create companies table before creating profitaxes table.

H_Bakhtar 2019-10-15 09:44:33
skys215 2019-10-15 09:28:38
I can’t see companies table creating

yeah thank you man

smallpigg 2019-10-15 10:27:51
Hello, can tinker show the result in a table form? Like mysql CLI
I want to see the result that one line for one record.
Tinker show a record used several line.
|