Category : backend

I want to pass some parameters to an after middleware after the controller has finished running, this is in order to invalidate any password reset tokens if a new one is generated. My code is: Controller public function resetPasswordRequest(Request $request) {$user = User::where(’email’, $request->email)->first(); if (!$user) { throw ValidationException::withMessages([ ‘message’ => ‘invalid_email’, ]); } ..

Read more

I’m working in a app, where coupons can be exchanged for digital credits. The problem is, once exchanged, I don’t have any means to know where those credits came from. I have drawn a diagram to see how can I update the database to support traceability, but I don’t feel is quite right. Thanks in ..

Read more

Let’s say we have a helper function, logDatabaseError($exception) that logs QueryExceptions to a special log. helpers.php function logDatabaseError ($exception) { $controller = ????;$function = ????; $log_string = "TIME: ".now().PHP_EOL;$log_string.= "User ID: ".Auth::user()->id.PHP_EOL; $log_string.= "Controller->Action:".$controller."->".$function.PHP_EOL;$log_string.= $exception.PHP_EOL; Storage::disk(‘logs’)->append(‘database.log’,$log_string); } This function is called from multiple controllers and multiple functions within those controllers. Whenever ..

Read more

Let’s say we have a helper function, logDatabaseError($exception) that logs QueryExceptions to a special log. helpers.php function logDatabaseError ($exception) { $controller = ????;$function = ????; $log_string = "TIME: ".now().PHP_EOL;$log_string.= "User ID: ".Auth::user()->id.PHP_EOL; $log_string.= "Controller->Action:".$controller."->".$function.PHP_EOL;$log_string.= $exception.PHP_EOL; Storage::disk(‘logs’)->append(‘database.log’,$log_string); } This function is called from multiple controllers and multiple functions within those controllers. Whenever ..

Read more

I’m doing full stuck development using Angular12 as Front End and Laravel as BackEnd. I want to do a search using multiple values but I don’t have any idea. I could search using a single value but I want to do with multiple values(AND oparation). LARAVEL api.php Route::get(‘/project/search/{request}’, [ProjectController::class, ‘search’]); ProjectController.php { if ($request===’business_divition’){ return .. Read more I have built a laravel application frontend and I want to integrate an admin dashboard. Is it advisable for me to build the dash myself or to use an external one like CoreUI or Voyager or any one recommendable? Sourc.. Read more Today I was trying to return a file as response with another array, but my front end stopped reading the blob. How can i do it? Example: return array("file"=>response()->file($file), "erros"=>$arrayDeErros); Thanks in advance Sourc.. Read more I’m doing an online exam system but I’m struggling with the database Structure, what I do in native PHP is creating separate tables for example: Table quiz info have this fields { id owner quiz_name question_qnty } Table questions have this fields{ id quiz_id question_number question } Table answers have this fields{ id quiz_id qeustion_number .. Read more I created a new Laravel project and downloaded the bootstrap CSS and JS files and put the CSS file in resources/css and the JS files of bootstrap and popper and jQuery in resources/js and in the welcome.blade.php I linked the CSS file and the JS files like this <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> .. Read more I changed XAMPP configuration ports and localhost, when I ran old project it doesn’t work so I need anyone to help me to match the .env with XAMPP configuration the XAMPP window Apache Service Window MySQL Service Window the .env file APP_NAME=Laravel APP_ENV=local APP_KEY=base64:kuAaczKFkzJWGNlZzrPpsBsmv+NNMCMPVwTsNYsbZyc= APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=stack LOG_LEVEL=debug DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=mobitech DB_USERNAME=root DB_PASSWORD= BROADCAST_DRIVER=log .. Read more I would like to briefly describe what I have done so far and what exactly the problem is and I hope you can help me. I have a Laravel 8 backend with Angular as my frontend. In my application I send an API so that the user can query his own data and also modify .. Read more Iam using this function but it doesn’t returning any value. upper line was working correctly the main problem is with second line. when i comment the second line the function works properly. function validate($data){ $data=trim(stripcslashes(htmlspecialchars($data))); $data=mysqli_real_escape_string($conn,$data); return$data; } Sourc..

Read more

I have created two Laravel projects, One for the Front-end and one for Backend(Admin panel), And I have created APIs in the backend, including login and Register APIs, And Except login and registration API, I have secured APIs with Passport security, Till now everything was fine, but, Now I have to send API-token in headers ..

Read more

Title is maybe confusing but I will try to explain what is that I need. I have application that shows tables of some place (e.g restaurant). This tables are shown to end user. But I want owner to be able to rearrange these tables position from admin panel. He will be presented container ( just ..

Read more

I have a table named wallet and a table named User. I want to know how can I use roles and permission of spatie (laravel) to ask a simple questions (in terms of code) Is X user is admin of Y wallet ? or how can I specify that X user is an admin of ..

Read more

Trying to sort assets based on price. blade.php <form action="/assets/search/" method="GET" class="form-inline"> @csrf <div class="searchByPrice pt-3"> <p class="font-weight-bold">Search By Price</p> <label for="price">Volume</label> <input type="range" min="0" max="500000" id="price" step="100" name="price" oninput="outputUpdate(value)"> <output for="price" id="volume">250000</output> <script> function outputUpdate(vol) { document.querySelector(‘#volume’).value = vol; } </script> </div> </form> Controller public function show(Request $request,$_id) { $query = Asset::query(); if .. Read more I am new to Laravel, I want to display the menu for each restaurant from the database, the list of Restaurants is in the home section and each restaurant must have a different menu web.php: Route::get("/Menu/", [HomeController::class, "menu"]); HomeController: public function menu() {$data=DB::table(‘restaurants_menu’) ->select(‘*’) ->get(‘*’); return view(‘restaurant_menu’,compact(‘data’)); } restaurant_menu.blade.php : <div class="menu-container"> @foreach($data as .. Read more Im building a seat reservation system and Im having trouble trying to display I have this layout: (its 5 blocks one for each day of the week, monday to friday) enter image description here Im using php+laravel in the backend and html+css+js in the frontend. I would appreciate any tips on how I should approach .. Read more Getting this error after updating the image. Call to a member function getClientOriginalExtension() on string This is the before code. If I dd(); this code I get the file name with the extension but it’s a string. So I cannot get the original extension.$image = $request->warrantyUpload;$destination = public_path(‘/uploads/’); $ext =$image->getClientOriginalExtension(); $mainFilename = .. Read more Frontend: Laravel Backend: Vue.js Database: MySQL The following steps need to be added: The Facebook authentication should be accessible via a direct button in webapp. Once clicked, it should authorize users to Facebook. This feature should directly take the user to a Facebook page (in modal) where they can authorize and link the account. It .. Read more I want to learn backend for iOS and android apps which I build with flutter. So I only understand dart and nothing else. Should I just jump straight to learning laravel or is there something I should learn first. I’m not interested in websites, even when I am eventually, I plan on building websites with .. Read more Good morning developers, iam working on ecommerce project using laravel and angular in laravel i made two tables ( brands – products ) and i need the brand has many products so i added this function to the Product model public function brand() { return$this->belongsTo(Brand::class); } and i added this function to Brand model ..

Read more

This is my job. When I run this job the online invoices query doesn’t display anything, but what is intriguing is that when I swap the places of the $onlineInvoices and the$offlineInvoices variables the $onlineInvoices query works while the$offlineInvoices doesn’t. It worked fine when I redefined the $monthlyInvoices again below the$offline_sales variable, ..

Read more

I designed a table that has some values for foods .I want to have date for each day that the customer choosed first of all it save in database with date and the if waiter wanted to see the foods of the day see the current time and date’s foods . thanks a lot Source: ..

Read more

I’m trying to make a user logged in at back-end who is already a user of another website of mine. For now I’m able to fetch the user’s data from previous website’s database using an API and make user registration during the login process. Same time I want this user to be logged in when ..

Read more