So I have this blog website which each blog post information is get from the admin user. In admin create post view I have a text area for the title which I can easily set its data to database by giving it a name, but then I have these buttons in my view(one for inserting ..
Category : database
I create new command in laravel: public function handle() { $serversList = [ ‘cubegame.pl’, ‘feerko.pl’, ‘skyup.pl’, ‘mcosada.pl’, ‘dragon-craft.pl’, ‘gc2.pl’, ‘mc.craftplay.pl’, ‘iskyblock.pl:25600’, ‘mc.craftmc.pl’, ‘mc.realcraft.pl’, ‘katomc.pl’, ‘mc.minestar.pl’, ]; foreach ($serversList as $server) { $req = Http::get("https://api.mcsrvstat.us/2/$server"); if ($req->ok()) { $status = $req->json(); // dump($status[‘motd’][‘html’][0]); $serv = Server::updateOrCreate( [ ‘name’ => $server, ‘ip’ => $status[‘ip’] ], [ ‘motd’ ..
Whenever I try to update the record in laravel in 8.2.1 version this error (POST http://127.0.0.1:8000/add-student 500 (Internal Server Error) ) comes to me and when i see in console it says ( xhr.send( ( options.hasContent && options.data ) || null ); ) two picture are also attached 1. My Code in inside.blade.ph and second ..
$products = product::select([ DB::raw(‘product_no as number’), DB::raw(‘product_name as name’), DB::raw(‘sum(total) as total’), DB::raw(‘sum(product_qty) as qty’), DB::raw(‘sum(product_price) as price’), ]) ->groupBy(‘number’) ->groupBy(‘name’) ->get(); return view (‘view’,[‘products’=>$products]); i need to insert the result to another table in database by laravel Sourc..
I’m writing an SaaS app aiming at (simplified) handling stocks, in Laravel. Every company registered get their own 200-299 or 040-049 (+3 digits) prefix, then when a custom barcode is needed, it should be generated by the system. The thing is, the remaining numbers (approximately 6 digits left) can be generated incrementally and can be ..
I’m working on SQL. My database has so many entry that reason query taking too time any solution to improve my query perfoment. I’m use many groupBy And Sum of value. My Query :- select distinct airplay_songs.song_uuid, airplay_songs.song_isrc, sum(airplay_songs.play_count) as play_count from artist_music inner join airplay_songs on artist_music.uuid = airplay_songs.song_uuid and artist_music.isrc = airplay_songs.song_isrc where ..
I have this Controller called GetChangeInfo public function GetChangeInfo(Request $request){ $customers = Customer::doesntHave(‘bookings’) ->doesntHave(‘product_baskets’) ->whereRaw("CONCAT(customers.id, COALESCE(customers.first_name, ”), ‘ ‘, COALESCE(customers.last_name, ”), ‘ ‘, COALESCE(customers.email, ”), ‘ ‘, COALESCE(customers.phone, ”), ) LIKE ?", ["%{$request->find}%"] ) ->orderBy(‘id’, ‘desc’) ->paginate(10); return response()->json($customers); } I want to insert customers.pending_update_info, 1 this code inside in whereRaw whenever i insert that ..
Hello im designing a database for users.This is my model.The field EIK is unique and there will be a main user(with non null value EIK) which can add more users(null value EIK).Is it bad practice to have unique field empty or not? | User | | ——– | | EIK – unique | | Email ..
$personalSale = DB::select(DB::raw("SELECT * FROM purchases a WHERE a.purchase_status IN (3001,3002,3003,4000,4001,4002,4003) AND a.purchase_date LIKE "%12/2020" AND (a.user_id = 50 OR a.user_id in (SELECT b.user_id FROM user_infos b WHERE b.referrer_id = 1911000140)) ORDER BY a.purchase_amount DESC LIMIT 10; ")); error: syntax error, unexpected ‘" AND ‘ (T_CONSTANT_ENCAPSED_STRING), expecting ‘,’ or ‘)’ Sourc..
so I have table in sql with 20 columns and I need one column to get the sum of other two columns, the data is showing in modal-fade dialog this is how it look like div id="show" class="modal fade" role="dialog"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title"></h4> </div> <div ..

this datasbe tables for example This is my Controller $categoryIds = Category::select(‘id’)->with(‘childrenRecursive’)->where(‘id’, 1)->get(); Ad::whereIn(‘category_id’, $categoryIds)->get(); This is my model public function parent() { return $this->belongsTo(Category::class, ‘parent_id’); } public function childs() { return $this->hasMany(Category::class, ‘parent_id’); } public function Ads() { return $this->hasManyThrough(Ad::class, Category::class, ‘parent_id’, ‘category_id’, ‘id’); } Have you any ida ?!! Sourc..

Hello i’m stuck to get the data from database through axios using vue js. In vue js developer tools i can get the data from my database like this : But when i looping it in v-for like this : <template> <div class="flex flex-col items-center py-4"> <NewPost></NewPost> <Post v-for="(post,i) in posts.data" :post="post" :key="i"/> </div> </template> ..
I would like to display the name of each entity in my table but it returns me Property [name] does not exist on this collection instance. My Controller $users = User::with(‘pearls’)->latest()->get(); the index.blade.php <thead> <tr> <th scope="col">SL No</th> <th scope="col">Name</th> <th scope="col">Email</th> @foreach($users as $user) <th>{{ $user->pearls->name}}</th> @endforeach <th scope="col">Actions</th> </tr> </thead> Sourc..
I need to insert array data into the 2 tables. My table structure and form structure are given below. Please check and help me to insert data. Getting an error in the browser My Controller public function prtmulti(Request $req) { $maxPrId = newpr::max(‘prid’); $requestData = $req->all(); if(array_key_exists("vendor_name",$requestData)) { $insertData = []; $uniqueData =array_unique($requestData["vendor_name"]); foreach ($uniqueData ..
Assume I use MySQL and there is two tables, students and parents_guardians table. Table students is used to store student’s data. While parents_guardians table is used to store student’s parents and student’s guardians. So, either a student can have father and mother as his parents, or a student can have uncle and aunt as his ..
im trying to search for name or id of students in the table but i do not know how to do that with router and controller. I already have the table and search form with button i need the list to show all data initially then display only the entered data when a name is ..
I am trying to capture image in android phone, but before capturing i wish to show user by which app to proceed further. My goal is to give user the list of apps which can click photo, but currently only camera photo is showing. Please guide me resolving this issue. I am trying to capture ..
I am working on constructing a social feed, just like Twitter. I have a table of posts, users, and followers. My goal is to optimize the feed query that will fetch all posts of the users you are following and order them by recency. The query looks like: SELECT * from posts inner join followers ..
I’m trying to store the id of a record within the record. I am aware I could just use a where statement to find the last ID and increment by one but I was curious is it possible to get the ID of the record whilst its been made. $ScreenshotOBJ = Screenshots::create([ $ScreenshotOBJ->CollectionID = $ScreenshotOBJ->id, ..
i need to update current table by value from another table depending on 3 conditions , i have "task" table which is contains id – task name – start date – end date – actual end date – score_id the second table which is contains id – name – score and 1 – a head ..
I’m trying to filter a query on a model that has a one to many relationship, but it’s not working. Correct output should remove all stocks that are expired, but it returns all the available stocks. Product: hasMany(Stock::class) Stock: belongsTo(Product::class) code: $keyword = $request->keyword; $data = Product::with(‘stocks’) ->where([ [‘pharmacy_id’, ‘=’, auth()->user()->pharmacy->id], ]) ->where(function($productModel) use($keyword) { ..

We try to achieve an AdminCMS coupon functionality with multiple, dynamic coupon rule base on products, its categories & sub-categories, users, seller, cart, and related database table columns and data value. We have created an e-commerce website where a user can buy products from the website, but in the cart order process, there’s a process ..
The following is a MySQL query. I know it is wrong because the EXTRA column cannot be used in the query. SELECT users.id, user_time.*, CONCAT(users.info1, users.info2) AS EXTRA FROM users JOIN user_time ON users.id = user_time.user_id WHERE EXTRA ="ABCDEFG"; But isn’t it possible to use this EXTRA column in Laravel? Something like… $table = User::join(‘user_time’,’user_time.user_id’,’users.id’)->select(‘users.id’,’user_time.*’,DB::raw("CONCAT(users.info1, ..
I’m using laravel 8 and I try to update data but it won’t save, and it really strange Here’s the controller private function _generatePaymentToken($kode) { $this->initPaymentGateway(); $pnd = new Pendaftar; $pnd = $pnd::where(‘nohp’, $kode)->get(); if($pnd->count()){ $customerDetails = [ ‘first_name’ => $pnd[0]->nama, ‘last_name’ => $pnd[0]->nama, ’email’ => $pnd[0]->email, ‘phone’ => $pnd[0]->nohp, ]; $params = [ ‘transaction_details’ ..
I work with categories in my project. Now my categories database structure is like this: id title description slug parent_id Problem: I currently have two categories for products. The first category is for "Selling" and the second is for "Buying" products. In the "Sale" category, sellers list their products for sale. And in the "Purchase" ..