Are you trying to add a column to an already existing table?

|
2019-05-24 01:06:12
I found solution that worked for me , I edited database.php file in config folder. Just edit

‘charset’ => ‘utf8mb4’,
‘collation’ => ‘utf8mb4_unicode_ci’,
to

‘charset’ => ‘utf8’,
‘collation’ => ‘utf8_unicode_ci’,

And it worked

ErgashevXurshid 2019-05-24 01:28:34
2019-05-24 01:06:12
I found solution that worked for me , I edited database.php file in config folder. Just edit

‘charset’ => ‘utf8mb4’,
‘collation’ => ‘utf8mb4_unicode_ci’,
to

‘charset’ => ‘utf8’,
‘collation’ => ‘utf8_unicode_ci’,

And it worked

Good job 👍

PHP Begginer 2019-05-24 15:00:19
Hi Guys , Iam add information to the database via the form but i get a weired error message
PHP Begginer 2019-05-24 15:00:21
Unprocessable Entity` response: {“error”:{“title”:[“The title field is required.”],”details”:[“The details field is required.”],”stock”:[“The stock fiel (truncated…)
fred 2019-05-24 15:09:21
2019-05-23 23:31:29
Hey fellas can anyone help me on migration
Error “ users table already exists “ please ASAP

Are you trying to add a column to an already existing table?, if not type on your terminal php artisan migrate:fresh

skys215 2019-05-24 15:31:00
PHP Begginer 2019-05-24 15:00:21
Unprocessable Entity` response: {“error”:{“title”:[“The title field is required.”],”details”:[“The details field is required.”],”stock”:[“The stock fiel (truncated…)

Print out the request

PHP Begginer 2019-05-24 15:32:29
array:5 [▼
“title” => “Testing”
“details” => “testing”
“stock” => “8”
“picture” => UploadedFile {#243 ▶️}
“category” => “1”
]
rahulnitc 2019-05-24 15:33:11
laravel_discuss-6413.jpg
Can any one help me to how can pass Berear token in header in swagger UI?
skys215 2019-05-24 15:37:37
Left side of headers, there is a authorization tab
rahulnitc 2019-05-24 15:43:16
skys215 2019-05-24 15:37:37
Left side of headers, there is a authorization tab

Sorry I didn’t under stand plz can you explain about it?

TeleMadDave 2019-05-24 15:46:06
You should correct write word ‘bearer’
rahulnitc 2019-05-24 15:53:54
TeleMadDave 2019-05-24 15:46:06
You should correct write word ‘bearer’

laravel_discuss-6418.jpg
I am getting an error in Swagger UI can help me?

maroong 2019-05-24 17:11:30
Leetump 2019-04-01 08:35:12
Thank

Did it work?

PHP Begginer 2019-05-24 17:50:24
422 Unprocessable Entity` response: ?
StanleyMasinde 2019-05-24 17:50:57
PHP Begginer 2019-05-24 17:50:24
422 Unprocessable Entity` response: ?

ajax or axios?

PHP Begginer 2019-05-24 17:51:46
normal laravel
StanleyMasinde 2019-05-24 17:51:54
PHP Begginer 2019-05-24 17:51:46
normal laravel

I know

PHP Begginer 2019-05-24 17:52:03
insert into database
StanleyMasinde 2019-05-24 17:52:31
what are you using in your javascript? axios or ajax?
PHP Begginer 2019-05-24 17:52:48
no
StanleyMasinde 2019-05-24 17:53:01
.fail(function(err){
if (err.responseJSON) {
for (const error in err.responseJSON.errors) {
if (err.responseJSON.errors.hasOwnProperty(error)) {
const element = err.responseJSON.errors[error];
$this.prepend(`<div class=”alert alert-warning”> ${element}</div>`);
}
} this is for ajax(example)
PHP Begginer 2019-05-24 17:53:21
public function PublishProduct(Request $request)
{
$rules = [
‘title’ => ‘required’,
‘details’ => ‘required’,
‘stock’ => ‘required|min:1’,
‘picture’ => ‘required|image’,
‘category’ => ‘required’,
];

//validate
$productData = $this->validate($request, $rules);

//Add the content the pic
$productData[‘picture’] = fopen($request->picture->path(), ‘r’);

//create a product

$productData = $this->marketServices->publishProduct($request->user()->service_id, $productData);

dd($productData);
return redirect()->route(‘products.show’,
[
‘title’ =>$productData->title,
‘id’ =>$productData->identifier,
])
->with(‘success’,[‘Product created successfull’]);
}

PHP Begginer 2019-05-24 17:53:33
this is an api
PHP Begginer 2019-05-24 17:53:38
consume an API
StanleyMasinde 2019-05-24 17:53:43
I want your javascript
PHP Begginer 2019-05-24 17:54:04
I don’t use javascript
StanleyMasinde 2019-05-24 17:54:30
PHP Begginer 2019-05-24 17:54:04
I don’t use javascript

Then how are you getting 422 error?

StanleyMasinde 2019-05-24 17:54:47
422 means the data is invalid
PHP Begginer 2019-05-24 17:55:15
The error comes from herer
StanleyMasinde 2019-05-24 17:55:15
it contains the validation meassge. an object with errors. good luck
PHP Begginer 2019-05-24 17:55:17
$productData = $this->marketServices->publishProduct($request->user()->service_id, $productData);

dd($productData);

StanleyMasinde 2019-05-24 17:55:37
where have you seen that error?
PHP Begginer 2019-05-24 17:55:59
when i am inserting data from the UI
PHP Begginer 2019-05-24 17:56:07
OR Form
PHP Begginer 2019-05-24 17:57:00
/*
* Publish a product on the API
* @return stdClass
* */
public function publishProduct($sellerId , $productData)
{
return $this->makeRequest(
‘POST’,
“sellers/{$sellerId}/products”,
[],
$productData,
[],
$hasFile = true
);
}
StanleyMasinde 2019-05-24 17:57:20
PHP Begginer 2019-05-24 17:53:21
public function PublishProduct(Request $request)
{
$rules = [
‘title’ => ‘required’,
‘details’ => ‘required’,
‘stock’ => ‘required|min:1’,
‘picture’ => ‘required|image’,
‘category’ => ‘required’,
];

//validate
$productData = $this->validate($request, $rules);

//Add the content the pic
$productData[‘picture’] = fopen($request->picture->path(), ‘r’);

//create a product

$productData = $this->marketServices->publishProduct($request->user()->service_id, $productData);

dd($productData);
return redirect()->route(‘products.show’,
[
‘title’ =>$productData->title,
‘id’ =>$productData->identifier,
])
->with(‘success’,[‘Product created successfull’]);
}

this method is not complete what happens if validation fails?

PHP Begginer 2019-05-24 17:57:52
public function PublishProduct(Request $request)
{
$rules = [
‘title’ => ‘required’,
‘details’ => ‘required’,
‘stock’ => ‘required|min:1’,
‘picture’ => ‘required|image’,
‘category’ => ‘required’,
];

//validate
$productData = $this->validate($request, $rules);

//Add the content the pic
$productData[‘picture’] = fopen($request->picture->path(), ‘r’);

//create a product

$productData = $this->marketServices->publishProduct($request->user()->service_id, $productData);

dd($productData);
return redirect()->route(‘products.show’,
[
‘title’ =>$productData->title,
‘id’ =>$productData->identifier,
])
->with(‘success’,[‘Product created successfull’]);
}
}

StanleyMasinde 2019-05-24 17:58:34
if ($validator->fails()) {
return redirect(‘post/create’)
->withErrors($validator)
->withInput();
}
StanleyMasinde 2019-05-24 17:59:59
i prefer this one from the request object

`$request->validate([
‘title’ => ‘required|unique:posts|max:255’,
‘author.name’ => ‘required’,
‘author.description’ => ‘required’,
]);`

maroong 2019-05-24 20:06:39
SQLSTATE[28000] [1045] Access denied for user ‘DB_USER’@’localhost’ (using password: YES) (SQL: select SUM(amount) as total from `tp_transactions` where `create ▶

Please How do I fix this error?

richitorres 2019-05-24 21:49:29
maroong 2019-05-24 20:06:39
SQLSTATE[28000] [1045] Access denied for user ‘DB_USER’@’localhost’ (using password: YES) (SQL: select SUM(amount) as total from `tp_transactions` where `create ▶

Please How do I fix this error?

you set a user, in your data base, on this case localhost

maroong 2019-05-24 22:03:09
richitorres 2019-05-24 21:49:29
you set a user, in your data base, on this case localhost

Ok

SkipperStrange 2019-05-25 00:01:51
Guys a little help
SkipperStrange 2019-05-25 00:02:32
I’m trying an ajax file upload with laravel 5.7 but the file object isn’t found in the request
SkipperStrange 2019-05-25 00:02:41
Any ideas why?
SkipperStrange 2019-05-25 00:03:07
I’m using blueimp jquery upload library
rizkyarlin 2019-05-25 01:06:14
SkipperStrange 2019-05-25 00:02:41
Any ideas why?

It’s hard to help you without looking at the code

rizkyarlin 2019-05-25 01:10:46
rizkyarlin 2019-05-25 01:06:14
It’s hard to help you without looking at the code

Something weird about my grammar, can someone fix it? Haha

richitorres 2019-05-25 02:20:51
SkipperStrange 2019-05-25 00:03:07
I’m using blueimp jquery upload library

use Vue.js or react js

SkipperStrange 2019-05-25 02:53:00
richitorres 2019-05-25 02:20:51
use Vue.js or react js

It’s a jquery library that does multiple uploads

|