Below is the data i am sending from client side: [{ result: null, test_id: 1 }, { result: null, test_id: 2 }] when i try to loop this with foreach, it is giving "Invalid argument supplied for foreach()" error and $request->tests returns like this: tests: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object ..

Read more

my console shows this error whenever I try to update my form using my ajax code: PUT http://127.0.0.1:8000/clinical/bbr-category-configuration-update/1 500 (Internal Server Error) Route: Route::put(‘/bbr-category-configuration-update/{category_id}’, [BBRCategoryConfigurationController::class,’update’]); Ajax: $(document).on(‘click’, ‘.update_category’, function (e){ e.preventDefault(); var cat_id = $(‘#edit_cat_id’).val(); var update_data = { ‘category_name’ : $(‘#edit_category_name’).val(), ‘category_description’ : $(‘#edit_category_description’).val(), } //token taken from laravel documentation $.ajaxSetup({ headers: { ‘X-CSRF-TOKEN’: ..

Read more

This function is not working. What wrong is going on here?? Attached the controller and route. Instead of going to cancel page it is redirecting to login page. Any help guys? This is the controller file where the function goes: public function payment_cancel(Request $request){ if($_SERVER[‘REQUEST_METHOD’] == ‘POST’){ $merchantTxnNo = $_POST[‘MerchantTxnNo’]; $TxnResponse = $_POST[‘TxnResponse’]; $txnAmount= $_POST[‘TxnAmount’]; ..

Read more

i am trying to loop the array with foreach in controller it is going as [object object] the error says invalid argument supplied for foreach() below is the type of array i am having [{ result: 45, test_id: 1 }, { result: null, test_id: 2 }] Here is my code foreach ($request->tests as $test) { ..

Read more

The project uses: Backend: Laravel 8 for the API and Nodejs 16.10.0 for angular server side rendering. Front: Angular 12.01 Description of the problem: I’m using Apache for serving my Laravel API and Reverse-proxying the Nodejs server that returns the frontend. I use pm2 to start the node process. I do have another node process ..

Read more

I’m having trouble with the foreign key. I have two tables. users table and user_address table. I’ll show you the migration. users table: public function up() { Schema::create(‘users’, function (Blueprint $table) { $table->id(); $table->string(‘name’); $table->string(‘username’)->unique()->nullable(); $table->string(’email’)->unique(); $table->timestamp(’email_verified_at’)->nullable(); $table->string(‘password’); $table->rememberToken(); $table->timestamps(); }); } and this is the user_address table: public function up() { Schema::create(‘user_address’, function (Blueprint ..

Read more

Route: Route::get(‘/lang-{lang}.js’, [AppHttpControllersLanguageController::class, ‘showw’]); app.blade.php (file is always loaded) <html> <head> <script src="/lang-{{ app()->getLocale() }}.js"></script> </head> </html> LanguageController.php public function __construct() { $this->middleware(‘auth’); } public function showw($locale) { if (is_array(config(‘app.locale’))) { $locale = in_array($locale, config(‘app.locale’)) ? $locale : config(‘app.fallback_locale’); } else { $locale = $locale == config(‘app.locale’) ? $locale : config(‘app.fallback_locale’); } $files = glob(resource_path(‘lang/’ ..

Read more

I have a page that displays all the records from the ‘Receita’ table like this: public function mostrarTodos() { $receitas = Receita::all()->toArray(); $ingredientes = Ingrediente::all()->toArray(); return view(‘home’, compact(‘receitas’, ‘ingredientes’)); } on the top of the page there is a form with many checkboxes that will filter the results displayed on the front page: <div class="col-span-2 ..

Read more

I’m trying to create a temporary URL for a file in my application. I’m able to upload the file to S3 bucket and I’m able to use the method Storage::temporaryUrl($this->url, now()->addHour(1)) genering the following URL https://xxxxxx.s3.eu-west-2.amazonaws.com/https%3A//xxxxxxx.s3.eu-west-2.amazonaws.com/images/fYr20cgYh3nAwoEEQCOTaVTLLo7nRFrXjp7cYcCz.jpg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVHH6TLEV3Z2FBWLY%2F20210622%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210622T191649Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6300aa81e69c6f4c96cb6f319a2b5ed2bfc2b2767138994928a49f3f93906745 When I click in this URL I get the following error: The specified key does not exist. From this ..

Read more

I have used Angular-11 for frontend and Laravel-8 for backend in a project. When user signup, there will be notification to activate. Laravel: public function toMail($notifiable) { return (new MailMessage) ->subject(‘Confirm your account’) ->line(‘Thanks for signup! Please before you begin, you must confirm your account.’) ->action(‘Confirm Account’, url(‘https://myapp/auth/signup-activate?token=’.$notifiable->activation_token)) ->line(‘Thank you for using our application!’); } ..

Read more

I have a table of players with a field called name (which is a string, of course). When adding a player to the database, I check for uniqueness using a custom rule: public function passes($attribute, $value) { return !($this->players->where(‘name’, $value)->count()); } This works most of the time. I noticed, however, that strings are cast to ..

Read more

Kind of a backstory, I inherited a Laravel project that initially used migrations and Eloquent to handle schema changes on it’s database, but through the course of development the original developer decided it would be better to just ditch to migration workflow and directly make the changes to the schema via sql/ phpmyadmin and in ..

Read more

Im trying to create a test, each test has an image(file) and one or more questions, and each question has an (file) and one or more choices… each questions has questions_text and questions_file and questions_choices(array of objects) this is my data() function: data(){ return{ succees:false, numberQuestions:null, file:null, questions_counter:1, categories:[], form: new Form({ test_type:’1′, test_name:”, test_description:”, ..

Read more

I’m seeding the test database with fake users, posts and categories but for some reason when I seed the database with more than 15 records Laravel throws this error: IlluminateDatabaseQueryException SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: categories.name (SQL: insert into "categories" ("name", "slug", "updated_at", "created_at") values (id, quibusdam-nihil-dignissimos-vitae-sint-minus-est-nostrum, 2021-06-22 17:52:02, 2021-06-22 17:52:02)) If ..

Read more

Using the following route declaration, I am trying to pass a parameter to the controller method however I am unsure of how to do this. I don’t want a route parameter but instead a hard coded parameter so that I can use the same function for both updating the current user and other users using ..

Read more