#### Category : database

For example I have online store with keyboards and mouses tables. And on the product(keyboard or mouse) page I want to show Recommended to buy with… section where other product (keyboard or mouse) will appear. So on Keyboard#1 page may be recommended Keyboard#2 and Mouse#1, that means on Keyboard#2 and Mouse#1 pages will be recommended ..

I am trying to make the catalog of a car web site. But I have a problem with the photos. I want that in the catalog each card has the image of the car (The cars have/will have more than one image, but I want only one to appear in the catalog), or a predefined ..

how to loop the data from database my route in laravel is Route::get(‘api/contacts’, [ContactController::class, ‘index’])->name(‘contact.index’); and im trying to display all the list but im confuse with the js code someone expert here and please help me class ContactController extends Controller { /** * Display a listing of the resource. * * @return IlluminateHttpResponse */ ..

I need your suggestion for this morph one to one table name. This for comic information. there’re 3 information, i need to split to different table. cause it additional information for specific media type ( comic, movie, tv show ). each type media will have different additional information i need to split. i think its ..

So I currently have a database for Recipe Management with 3 tables: Recipe table holding everything but ingredients, ingredients table with the ingredients name and category and then a composite table joining the two to avoid the many to many relationship the composite table has quantity and measurement aswell as the two primary keys. I ..

i want the visitors to be able to send a contact form to the admin email and i am able to do it locally and received emails but when i uploaded the project to the cpanel and tried to send emails emails will go through to the database but not receiving anything in my mail ..

I have an HTML section that tagged with ID below: <section id="contactus" style="background-color: #fff"> it is a Contact Us From that will send emails to admin but i want the route to go back to this section after submitting the form this is the Route: Route::get(‘/’, [ContactUsFormController::class, ‘createForm’]); Route::post(‘/’, [ContactUsFormController::class, ‘ContactUsForm’])->name(‘contact.store’); so ‘/’ is my ..

Is there possibility to get whole database’s table with it’s associates? My example class Gambler extends Model { use HasFactory; public function horse() { return $this->belongsTo(Horse::class, ‘horse_id’, ‘id’); } } I am fetching data of Gamblers with axios, wich is being returned with this code in controller public function getGamblers () { echo Gambler::all(); } .. Read more In my register controller, I have added the code in create function: Artisan::call(‘migrate’); and also added use Artisan; in the header. However, I am facing the error of "Base table or view not found" Sourc.. Read more Laravel Migration One of my table have grater then 250 columns. When I run migration its showing Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. In local system I have resolved this error by editing file – nano /etc/mysql/my.cnf .. Read more I have a project named visitor management and I am creating an ID for each company that will have access to the visitor management web app. I am trying to create a function that will automatically create a separate homepage for each company when I add them into the system. For example, I add company1 .. Read more , So I wanted to retrieve JOB information from Indeed for My website, I have read all their documentations According to this I need a PublisherID of my account perhaps , but I am not able to find it anywhere on INDEED , I have searched a lot on the internet I got some Tutorials .. Read more I want to remove data if AB and BA is the same This is my code: DB::table(DB::raw(‘tenant_db.sales_data as b’)) ->selectRaw(‘a.product_id as product_id, b.product_id as bought_with, count(*) as times_bought_together’) ->leftJoin(DB::raw(‘tenant_db.sales_data as a’), function ($join){ $join->on(‘a.sale_id’, ‘=’, ‘b.sale_id’);$join->on(‘a.product_id’, ‘<>’, ‘b.product_id’); }) ->havingRaw(‘SUM(a.qty) >= SUM(b.qty)’) ->groupBy(‘a.product_id’, ‘b.product_id’) ->orderBy(‘times_bought_together’, ‘DESC’) ->get(); I want the most bought item on ..

good day, I did some research but I couldn’t find any results so I want to ask a few questions. My question is this: Sample Filtering -XL, L -Red, Yellow, Green For example, I want to list xl and l sizes in 3 colors. here L-RED also needs to be Displayed in XL-Green logically Briefly: ..

I have millions of records from dozens of tables, I want to modify, remove, transform certain records or table structure, then newly transformed DB to be transferred to another server with downtime of 6 hours.. My current idea: temporarily spin up high-performance VPS (migration server) connect with the old DB run transformation using laravel queue ..

This query works with group by $data = DB::select(DB::raw("SELECT SUM(pending) as total , datediff(NOW(), created_at) as maturity FROM admin_case_info WHERE deleted_at is NULL group by maturity ")); But when I joined 2 tables.$data = DB::select( DB::raw("SELECT admin_case_info.case_type, admin_case_info.case_status, SUM(admin_case_info.pending) as total, datediff(NOW(), admin_case_info.created_at) as maturity FROM admin_case_info JOIN users_mws on users_mws.id = admin_case_info.users_mws_id JOIN ..

Want to remove duplicate data based on Quantity, DB::table(DB::raw(‘tenant_db.sales_data as b’)) ->selectRaw(‘a.product_id as product_id, b.product_id as bought_with, count(*) as times_bought_together, SUM(a.qty) AS aQuantity, SUM(b.qty) AS bQuantity’) ->join(DB::raw(‘tenant_db.sales_data as a’), function ($join){$join->on(‘a.sale_id’, ‘=’, ‘b.sale_id’); $join->on(‘a.product_id’, ‘<>’, ‘b.product_id’); }) ->groupBy(‘a.product_id’, ‘b.product_id’) ->orderBy(‘times_bought_together’, ‘DESC’) ->get(); Something like this ->having(‘aQuantity’, ‘>’, ‘bQuantity’) Result that I get 0 => .. Read more I am actually a beginner and this is my first "big" project. I am building a web app for a local detergents shop that should allow the users to order a local delivery of the products at home. I am using Laravel, darryldecode’s Cart implementation and Voyager as an admin panel. Everything was going well .. Read more Expect: select robotid, number from tool where is_active = 1 select * from robot_team where id = robotid( robotid from tool) foreach id(from robot_team), number(from tool) , status_za(from robot_team), status_zb(from robot_team), status_zm(from robot_team), status_qs(from robot_team) Result: cannot show success through postman Code: public function robotStatus() {$arr=[]; $robotlist = DB::table(‘robot_team AS u’) ->Join(DB::connection(‘sql’)->table(‘tool AS m’), .. Read more This is the code that was in custom php. It is a javascript code to display the chart of the data provided. Now I am converting it to a laravel project. The problem is earlier in the data [] array of the chart it was looping and echoing data in the array. Now when I .. Read more I want to group by date in single query but for different data. I have tried this so far$record_by_date = DB::select("SELECT SUM(amount) as ‘amount’, cast(date as date) dateAdded FROM expense_incomes WHERE (CASE WHEN type=’Expense’ THEN ‘Expense’ WHEN type=’Income’ THEN ‘Income’ END AS Type) GROUP BY cast(date as date)"); First is it correct way to ..

The data for one of my relationships should or should not be displayed based on a condition based on the item I’m trying to retrieve. personDecodedId = Hashids::decode($perrson_id)[0];$person = Person::where(‘id’, $personDecodedId) ->withMediaAndVariants([‘avatar’]) ->with([‘person_feeds’ => function($query) { \$query->withMediaAndVariants([‘children-image’, ‘feed-avatar’, ‘transaction’]) ->orderBy(‘created_at’, ‘DESC’); }, ‘team.owner’, ‘order’, ‘order.contacts’]) ->first(); My person_feeds relation contains a boolean field named ..