Laravel Error:Integrity constraint violation

yesterday : when i am trying to submit data to store in database i got error integrity constraint violation rule

because role_id is foreign key and i did not mention this field in user model.

Solution: after role_id mention in user model my error got solved

https://gist.github.com/rakesh1166-cm/6e233a6d0f51504801713420cb483338#file-users-php

Tagged :

How to Store Multiple Records using Checkbox in Laravel?

First Part: first of all, we will learn how to design or getdata in blade file

In table we will set one field default value as no while migrating data

test_migration.php

In blade file we will create one table

Next, in js we will create one fetch function

onclick java script function

Routing:set route

Route::prefix(‘/touroperator’)->group(function () use ($namespace) {

$controller = $namespace.'\TourDashboardController';
$tourcontroller = $namespace.'\TourDetailController';

Route::get(‘toursdetail/{email}’,”$tourcontroller@gettrip”);


});

create function in client side controller

Set env file:

GET_MYHOLIDAYTRIP_URL=/api/v1/j/gettripdetail

Set Config file:

GET_MYHOLIDAYTRIP_URL’ => env(‘GET_MYHOLIDAYTRIP_URL’, ‘not found in .env file’),

Routing set Server side:

Route::get(‘gettripdetail/{email}’, ‘Admin\AdminTPController@tripdetail’);

Create function in server side:

Second Part: thereafter, we will learn how to store data after selecting in blade file

Set Routing(Client side microservice) :

Route::prefix(‘/touroperator’)->group(function () use ($namespace) {

$controller = $namespace.'\TourDashboardController';
$tourcontroller = $namespace.'\TourDetailController';

Route::post(‘permissiontour/{email}’, ‘AdminController@addpermission’)->name(‘permissiontour’);
});

Create function in client side controller

Set Env file

PERMIT_TRIP_URL=/api/v1/j/permittrip

config file:

‘PERMIT_TRIP_URL’ => env(‘PERMIT_TRIP_URL’, ‘not found in .env file’), 

Set Routing in server side Microservice

Route::post(‘/permittrip’, ‘Admin\AdminTPController@storepermission’);

Create function in controller server side microservice

Tagged : /

Laravel Error: Creating default object from empty value when store data

today,I am updating data in one table(package table), but I wrote different modal name Trip Category

So,be careful while you are updating data ,choose correct modal name

Tagged :

How to update multiple table rows using single edit button In Laravel Microservice

I have three table package,addimage,iternaries and triptitle is foreign key(common key) for all three table. my requirement is if i update package table using edit button then automatically updated addimage,iternaries table

In above figure 3 table package,addimage,iternaries and trip title and trips are foreign key i want to update those row whose triptitle or trips name is couple tour

refrence:https://stackoverflow.com/questions/45912985/laravel-update-array-syntax/45913079

Tagged :

How to delete multiple table rows using one delete button In Laravel Microservice

I have three table package,addimage,iternaries and triptitle is foreign key(common key) for all three table. my requirement is if i delete package table using delete button
then automatically deleted addimage,iternaries table

In above figure 3 table package,addimage,iternaries and trip title and trips are foreign key i want to delete those row whose triptitle or trips name is couple tour

Query:

Tagged :

ERROR: Unable to store image in particular directory

today when i storing image then one error appears

Solution:I have given permission to that directory folder public folder after that my issue is resolved

chmod -R 777 ./public

refrence:https://stackoverflow.com/questions/34836602/laravel-uploading-file-unable-to-write-in-directory

Tagged : /

How to fix syntax error or access violation while use Group by

above error appear if you apply groupby in controller function is given below figure

Solution 1:In config/database.php at “mysql” change : ‘strict’ => true, to false

reference :https://stackoverflow.com/questions/49635699/laravel-distinct-on-join-results-not-working-in-query-builder

now Your bug resolved

Tagged : /

How to add multiple image using Laravel Microservice

Step 1: take input image name as array and write multiple in blade file

Step 2:store data using ajax

Step 3: set routing

Route::prefix(‘/touroperator’)->group(function () use ($namespace) {

$controller = $namespace.'\TourDashboardController';
$tourcontroller = $namespace.'\TourDetailController';

Route::post(‘addimage/{email}’, “$tourcontroller@addsimage”);

});

Step 4: In client side controller create function to get access token

take a variable as array and pass inside for loop and all the data pass inside for loop till no of image selected

Step 5: set env and app config file

ADD_MYHOLIDAYIMAGE_URL=/api/v1/j/addimagedetail

Step 6: Set routing in server side

Route::post(‘/addimagedetail’, ‘Admin\AdminTPController@storeimages’);

Step 7: apply bussiness query logic in server side controller

Finally our output looks like

Tagged : /