Questions tagged [laravel-5]

Laravel, introduced during the period between 2015 and 2020, showcases Laravel 5. This particular version of Laravel, an open-source PHP web development MVC framework, was meticulously crafted by Taylor Otwell. It revolutionizes application creation through its straightforward and expressive syntax. For any queries pertaining to Laravel in general, make sure to utilize the efficient laravel tag.

Eloquent in Laravel 5 makes it easy to retrieve all attributes from two related tables

Hello, I am working with two tables - Users and Posts - that have a one-to-many relationship. My goal is to retrieve all the data in just one query using Eloquent, resulting in: Users Table: id | name Posts Table: id | user_id | title| body The retriev ...

In Laravel, I am facing an issue where I am unable to trigger any event on the data that I have appended using

Currently using Laravel 5.6 Implemented the following event to append div.categoryAjaxId: The code works as expected and successfully appends my content. //--------- get product ------------------------- jQuery('.orderProduct').click(function( ...

How to Use Laravel to Create HTML Divs Without Images

While working with a text editor, we have the ability to incorporate various HTML tags such as images and videos. However, I am only interested in displaying text fields. When I use {{$loop->content}}, it displays: <p><strong>EXAMPLE</st ...

Retrieve the HTML data through Ajax in a Laravel DataTable with the assistance of the yajrabox package

Utilizing the package to incorporate an ajax datatable in my Laravel application. Within my controller class, I have implemented the following method for returning data for the datatables: function ajaxList() { // Fetch users with related groups and ...

Implementing API token authorization in Laravel 5.5

Currently, I am in the process of authenticating our users through the API token. This is the snippet from my config/auth.php file: 'guards' => [ 'web' => [ 'driver' => 'session', ...

Eliminate duplicate time slots in Laravel and Vuejs

Currently, I am delving into laravel(5.2) and vuejs as a newcomer to both frameworks. My goal is to utilize vuejs to eliminate redundant time slots. In my blade file, the code looks like this: <div class="form-group"> <label for="form-fi ...

Redirecting URLs with Laravel

Here is the URL for my project: http://localhost/starmaker/admin The site works perfectly, but if I add an extra slash to the URL it redirects to localhost. For example: http://localhost/starmaker/admin/ (I added an extra slash after admin) an ...

Seeking clarification on how Laravel Facade works

While going through the Laravel documentation for version 5.2, I came across the implementation of facade in Laravel. <?php namespace AppHttpControllers; use Cache; use AppHttpControllersController; class UserController extends Controller { ...

Converting Laravel Custom Error Validation JSON Response to an Array

I am currently working on developing an API for a registration form and running into an issue with the error format. While the validator correctly displays errors in an object format, I require the JSON response in an array format. $validator = Validato ...

Handling MethodNotAllowedHttpException in IIS, AngularJS, and Laravel: A Comprehensive Guide

Currently, I am diving into the world of AngularJS 1.5.8 + Laravel 5.3.17 + PHP 7 hosted on IIS/Windows 10 by following this helpful tutorial. However, when attempting to send a HTTP request using AngularJS $resource.delete() to Laravel, I keep encounteri ...

Unable to make changes to the data

Journey Route::resource('/videofile', 'VideoController'); VideoController public function update(Request $req, $id){ $video = Video::findOrFail($id); if($req->hasFile('UserVideo')){ $vid = $req->file(& ...

Enable the option to deactivate specific dates in the datepicker function

In my Laravel application, I have an online appointment form that includes a "Select Doctor" field and a "datepicker." For example, if doctor "A" is available at the clinic on Saturday, Monday, and Wednesday, while doctor "B" is available on Sunday, Tuesd ...

Error message 23000: The integrity constraint has been violated. The column "page_id" cannot have a null value in Laravel version 5

Currently, I am using Laravel 5.2 along with jQuery AJAX to work on an application where I need to pass a large amount of data through AJAX requests. However, when dealing with larger datasets, I encountered the following error: SQLSTATE[23000]: Integrity ...

The issue with using HTML code inside a variable that is passed into a partial view is that the code is not being

I have created a partial view to show the page header, which takes in two variables - an Icon and a title. The code for pageHeader.blade.php is as follows: <div class="page-header"> <div class="row"> <!-- Page header, center on small sc ...

Secure Routes and Views with Laravel Package?

I've been creating a custom package specifically for Laravel 5.2 and I have reached the stage where I am integrating Authentication. I attempted to include an Auth folder in my resources/views directory, along with the necessary Controllers in my package ...

Utilizing npm packages in Laravel: a step-by-step guide

I am having trouble utilizing an npm package in my Laravel 5 application. I am not very familiar with node and require, so I would appreciate some help understanding how to properly use npm packages. The npm package I am attempting to use is: https://www ...

Issue in Laravel: Unable to catch exceptions from a specific package using try-catch block

I am currently utilizing a package https://github.com/barbushin/php-imap in my project to retrieve emails from a mail server. Below is the snippet of code I have implemented: $folder = Storage::disk('local')->getAdapter()->getPathPrefix(); try { ...

Implementing Laravel's functionality for calculating average ratings with the help of jQuery

In my database, I have two tables named Users and ratings. The Users can give ratings to consultants, and the Ratings table structure is as follows: User_id | consultant_id | rating --------------------------------- 1 1 2 ...

Generating JSON output in PHP

I've been struggling to figure out why I can extract some parts of the JSON data but not others... Essentially, I am retrieving JSON from a URL (). In my PHP code (using Laravel5), I have the following: $url = 'https://public-crest.eveonline.co ...

The cache data is not displaying the expected result upon filtering in Laravel 5.1

What is this all about? Exploring different methods to filter the cache data. Here's a snippet of code showcasing two approaches. Approach : 1 $Categories = \Cache::rememberForever('Categories', function() { return \App&bsol ...

Utilizing Laravel 5.6's Eloquent ORM for table joins

As I work with Eloquent ORM collections and query builders, I am currently exploring how to perform joins and apply "where" conditions within a collection similar to the query builder. Let's consider the tables: Users: ID | Name | Last name -------- ...

The speed at which Laravel loads local CSS and JS resources is notably sluggish

Experiencing slow loading times for local resources in my Laravel project has been a major issue. The files are unusually small and the cdn is much faster in comparison. Is there a way to resolve this problem? https://i.stack.imgur.com/y5gWF.jpg ...

Does the DateTime class in PHP create issues within Laravel 5.1?

After implementing this code in my Laravel 5.1 project's controller: $start_date = "2015-06-10"; $date = new DateTime($start_date); I encountered a persistent issue when running the code on both Chrome and Firefox. My website would become unresponsive at ...

Troubleshooting Vue Component Visibility Issue in Laravel 5.4 with Passport Integration

Implementing passport using Laravel 5.4 has been a smooth process following the official documentation step by step. All was going well until I reached the "Frontend Quickstart" section. After executing the command to publish the vendor: php artisan vend ...

Creating a dynamic variable in Laravel 5.8 is quite simple. You can achieve this by using the "?" symbol as a

Here's an example of how to set parameters: For instance: http://localhost/firecek_web/pengaduan?barcode=8571385 Define the route: Route::get('/pengaduan','PengaduanController@index'); ...

Issues with Laravel PUT request not capturing parameters/inputFinding troubles with Laravel

I've run into a strange issue while using Laravel 5.1 - I can't seem to get parameters with the PUT method. Tool: I've been using POSTMAN (a chrome extension). Here's My Route Route::put('testing_put',function(Request $r){ print_r($r); }); The ...

Exploring the Organization of a Laravel Application (API, Administration, User Interface)

Help Needed with Organizing My Laravel App I am looking to structure my Laravel application in the following way: API Admin panel Public website So far, I have started building a folder structure that looks like this: app/ Http/Controllers/ ...

Laravel 5 is known for experiencing a frustrating "This site can't be reached" error message when attempting to download a file

I am experiencing an issue with my Laravel 5.2 and PHP7 setup on my hosting server. Everything seems to be working fine, except for the links that are supposed to generate and download xlsx files using Laravel Excel. Whenever I click on these links, I enco ...

Encountering an issue with Laravel 5.2: Generating default object from empty value

Currently, I am in the process of developing an application with Laravel 5.2. My objective is to build an Edit modal using jQuery. Unfortunately, each time I attempt to update a record in the database, I encounter a 500 internal server error. Upon investig ...

Validating PUT/PATCH requests in Laravel 5.2's REST controller

I'm encountering an issue with Laravel that is resulting in a 405 MethodNotAllowedHttpException error. I've been attempting to implement validation for update requests in my resource PointController, but it seems that the validation rules defined in the @u ...

How to use jQuery to dynamically add a variable to a request in Laravel 5.2

Is it feasible to append a variable to the Laravel cookie in the client using jQuery? Understandably, the Cookie is linked to the request during GET? Can you include a variable in the $request container in Laravel 5.2 using jQuery before initiating a GET ...

Fix Vue by deleting "public" from the file path

After removing the "public" from the URL path following this guide Laravel 5 – Remove Public from URL, I have encountered an issue with Vue scripts not working properly. Interestingly, if you add "public" back to the path, the script works fine (http:// ...

Utilizing Laravel's Gate and Authorization features within VueJs

I've come across an interesting challenge that I haven't seen addressed before - how can I implement VueJs authorization actions in Vue templates? When working with Laravel's blade, handling this task is quite straightforward using the @can ...

Error: Unable to locate Mix manifest file in Laravel 5.7

I recently started learning Laravel 5.7 and encountered an error that says: The Mix manifest does not exist. (View: /var/www/html/laravel/resources/views/frontend/layouts/app.blade.php) Any help would be greatly appreciated. ...

Having trouble with the query string functionality in Laravel 5?

Within my code, I have utilized {!! URL::route('editCatForm',['id'=>$row->id]) !!} to navigate to the named route editCatForm with a query string of ?id=5 or any other value dynamically retrieved from $row->id @foreach($catego ...

Laravel encounters a critical FatalErrorException within the SerializableClosure.php file

I encountered a problem with my Laravel application. Can someone assist me in troubleshooting this particular exception? FatalErrorException in SerializableClosure.php(153) : eval()'d code line 2: I am unable to call the getOwnerEmail() function on an ...

Unable to retrieve dropdown value using JavaScript and display it in a div

javaScript code: Retrieving data from a dropdown and displaying it in the inner HTML of a div. function showcost() { var days = document.getElementById("Ddays"); var Dudays = days.options[days.selectedIndex].text; var div = docu ...

Laravel and jQuery: Seamlessly Uploading Images with AJAX

I have been facing issues while trying to upload photos in Laravel using jQuery AJAX. I keep encountering an error message: The photo must meet the following criteria: - The photo must be an image. - The photo must be a file of type: jpeg, png, jpg, gif, ...

Retrieve the user ID during the login process using LoginController.php in Laravel

After a user logs in, I need to retrieve their user ID immediately. I have attempted to do this using a request but encountered an error message that says: "Too few arguments to function AppHttpControllersAuthLoginController::redirectTo(), 0 passed ...

Laravel issues with displaying data in a 'foreach' loop

I encountered a quirky issue while working with Laravel 5.2. I have a chunk of text that I'm attempting to display using some explode functions. The strange part is, Laravel is rendering it oddly by adding incorrect ':' before the end of the ...

What sets Laravel 5.1's Event and Mail:queue apart?

After a user successfully registers on my registration form, I would like to send them an email. To ensure that the page's response time is not affected, I want to run the email process in the background. In order to achieve this, I came across two m ...

Sending PUT and DELETE requests in a Laravel application hosted on a shared server

I have developed a unique Laravel CMS application that is functioning perfectly on my local environment. Now, I am attempting to deploy it on a shared hosting server. To achieve this, I have organized all Laravel app files and folders (excluding public) i ...

Passing data with middleware redirection

Working on my project using Laravel 5 and feeling a bit puzzled at the moment. I'm trying to check if a user is logged in using my middleware. If not, I want to generate a unique link for that particular user like so: $code = str_random(32); return r ...

What steps should be followed to set up multiple login accounts?

Having an issue with Laravel 5.2.39 where after logging in successfully, the webpage doesn't redirect to member/add-ticket. Can someone point out what might be wrong? Below is the code snippet: Kernel.php protected $middlewareGroups = [ 'web' =& ...

Is there a way to efficiently bulk insert data into MySQL using the firstOrCreate function in an

Is it possible to perform bulk insertion in MySQL using the firstOrCreate function in Laravel when data is being sent through a RESTful API? This is how my Model looks: { "hashtags": [{ "text": "hashtag1" }, { "text": ...

Encountering an error in a Laravel application when attempting to return JSON data using

After submitting my page, I am trying to display any validation errors underneath the appropriate form field if there are any. Currently, I am encountering an error in my console. If you could take a look at the code and suggest any changes to improve it, ...

Display the most recent product category exclusively in Laravel 5.8

Within my database, I have three entities: products, categories, and product_category. A single product can be associated with multiple categories, and some of these categories may have a parent category. The desired information on how these entities are r ...

disable any other active toggle in a vue component

Exploring JavaScript and how to accomplish the following tasks Snapshot The issue I am facing is that if I click on a product, and then click on settings, both are open. However, I want only the currently clicked toggle to be open. For instance, if I cl ...

Challenges with Validating Bootstrap Datepicker Functionality

I need to restrict the datepicker input control to only allow selection of dates from the current date onwards. Despite trying to implement validation using the bootstrap-datepicker library and the following JavaScript code, I am still facing issues: $(' ...

Validating uploaded files in Vue and Laravel: A guide for frontend file validation

I am currently working on a Vue app that has an image uploader feature allowing users to upload multiple files. I want to implement validation to ensure that only images of a specific size are uploaded. If the uploaded files do not meet the requirements, I ...

Using Angular and Laravel to display JSON data extracted from a MySQL database

I am currently retrieving data from MySQL using Laravel query builder, converting it to JSON format as per the suggestion of W3schools. However, when trying to display the fetched data using AngularJS, I end up with a blank page. Laravel route Route::ge ...

Setting up a Laravel project on a DSO handler server

I am currently working on a Laravel 5.0 project that needs to be tested on servers supporting different PHP handlers such as: 1. suPHP (Single user PHP) 2. FCGI (FastCGI) 3. CGI (Common Gateway Interface) 4. DSO (Dynamic Shared Object) The project ru ...

Issue with Laravel 5.3 database insertion failing for URLs

Currently, I am expanding the AuthController by adding more fields, all of which are functioning well except for a link to the user's avatar (a URL approximately 150 characters long). The code snippet is as follows: return User::create([ 'firs ...

Showing navigation items in Vuejs based on authentication status

In my current project, I am developing a Single Page Application (SPA) using vuejs with vuetify and integrating authentication via a laravel/passport API. The challenge I'm facing is related to conditional rendering of navigation icons based on user authen ...

Challenge with Laravel 5.4 Eloquent Relationships

I have come across a challenge with Eloquent Relationships that I need help with. I have two models, User (pre-existing in Laravel) and Role (which I created). In the migration for these models, I added role_id as an additional column because I want every ...

Pagination in Laravel using Angular 5

Currently experiencing pagination issues in an Angular5 and Laravel5 project. The JSON values are as follows: { "products": { "current_page": 1, "data": [ ... ], "first_page_url": "http://localhost:8000/api/ ...

In Laravel 5, editing, deleting, and viewing entries is restricted to only the owner (creator) of

Just dipping my toes into the world of Laravel and I've encountered a little query. I want to set it up so only the original Creator/Owner of a post can make changes like editing, viewing, or deleting it. Each Post is linked to a User, where each Us ...

Trouble persisting user sessions in Laravel 5.1

Hey there! I'm encountering an issue with storing and retrieving sessions during login processes. After successfully storing the session in one page, it appears as null when trying to access it on the next page. The permissions for the storage folder ...

Creating Laravel log files with a unique naming convention utilizing the current date

Laravel, by default, saves the log file to a single file named laravel.log in the location /storage/logs/laravel.log My query is how can I generate a new log file every day and store them with filenames like /storage/logs/laravel-2016-02-23.log which repr ...

Discovering the Secrets of Laravel 5: Harnessing the Power of Vue.js to Access Data Attribute Values

I'm a beginner in vue js. Within our app, we have implemented validation to check if a value already exists in the database. I would like to enhance this feature by making it dynamic. To achieve this, I have added a data attribute to my field which is upda ...

Presenting a dynamic selection of files from a database in a dropdown menu with looping functionality using Laravel

I have a dropdown menu that I want to use to display input files from the database based on the selection made. Here is the scenario: When a dropdown option is chosen, it should show input files derived from the "loop_atachment" table (based on the select ...

Hospitals that utilize this technique are nonexistent

Currently, I am working on a project that involves establishing a many-to-many relationship between two tables. In my model class, I have created a method to handle this relationship. However, whenever I try to invoke this method from my controller, it thr ...

Every time I set up Laravel/Passport, I encounter an issue where the authentication does not seem to work properly,

I successfully set up authentication using the Make::Auth method. Everything was working fine until I installed passport and encountered an error that said "page expired" when attempting to login. The login function is not working as expected, so any assis ...

Combining session and token guard in Laravel 5.2 for simultaneous route access

We previously used session guard for authorization and found it sufficient. Now, we are in need of adding authorization through tokens (either in headers or GET parameters) while still using session authorization on the same routes. The token-based autho ...

The autoloading of Laravel phpspec is not working

Currently, I am in the process of setting up phpspec within a Laravel project. After successfully installing phpspec, I have been able to run it within my project without encountering any issues. Within my composer.json file, the relevant lines are as fo ...

Issue with radio button functionality while iterating through loop

I am currently working on a form where users are required to select one answer from each question using radio buttons. The loop logic allows for the selection of one answer per question. <form method="POST" action="{{url('quiz/check')}}" {!! ...

What is the method for extracting input from a paragraph in Laravel?

<div class="form-group"> <label for="amount_due" class="col-sm-4 control-label">{{trans('sale.amount_due')}}</label> <div class="col-sm-8"> <p class="form-control-static">Unique text to be added here</ ...

"Encountered error converting array to string while attempting to swap out two elements

Here is the code snippet I am working with: <?php $url_constructor = "http://myecommerce.dev/edit/article_name/article_id"; $cart_line_link = str_replace($url_constructor, array( 'article_id', 'article_name' ) , array( $ ...

Filtering a list of posts in Laravel using the whereBetween method

I have a list of posts with a "created_at" column. I am looking to only retrieve posts that are within 10 minutes old based on their creation time. I have come across many examples of using whereBetween, but they all involve passing values through inputs ...

Laravel framework version 5, Homestead environment, authentication for registration and login is not syncing with the database

I've recently transitioned from using localhost to Homestead (homestead.app) with Laravel 5. While everything was working fine with laravel Auth on localhost, I am now facing issues with connecting to the database on Homestead. Are there any configuratio ...

Struggling to integrate Node with Laravel and browsershot

I've been attempting to utilize the package below for generating PDFs. https://github.com/spatie/browsershot Node is correctly set up: C:Users>node -v v10.16.3 However, I'm facing difficulties making it work with Laravel and browsershots. Here's t ...

The recent upgrade to Laravel 5.2 has caused issues with PHPUnit, rendering it inoperable

To ensure our project stays current and can benefit from the latest developments, we made the upgrade from Laravel 5.1 to 5.2 yesterday. After spending some time tweaking our codebase, everything appears to be functioning normally, except for the fact that ...

Exploring the functionalities of quill modules in conjunction with vue2-editor and webpack mix

I am encountering an issue while using vue2-editor and importing Quill modules, despite registering them as instructed. The error message states that window.Quill is undefined. Even after attempting to include window.Quill and Quill with webpack plugin mi ...

How can a variable be passed to route.php from middleware in Laravel 5.2?

I have created a middleware and I need it to pass the variable $role to the route.php file. public function handle($request, Closure $next) { if ($this->auth->check()) { $role= "normal"; $user_roles = AssignedRoles::join(&ap ...

In my AJAX success function, I am encountering difficulties with reloading the page

Could someone please assist me with reloading the page after a successful member login? Here is my code, but the page doesn't seem to reload. Please note that I am using Laravel 5.4. $.ajax({ url: 'json/login', ...