Questions tagged [laravel]

Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern and based on Symfony. The source code of Laravel is hosted on GitHub and licensed under the terms of MIT License.

0
votes
0answers
6 views

Creating A Data Record For a One-to-Many Category Structure With Laravel

I'm new here. With Laravel, I want to save data with multiple selection features. however, the methods in the model file I created do not appear.I'm new to larvae, how can I fix it? I couldn't run the ...
0
votes
0answers
15 views

How am I meant to render different buttons based on a record in database when having a separated front & back end

I have a separated front and back end. The front-end is JavaScript with Vue.js and the back-end is PHP with Laravel. The authentication is token based. I have created a functionality which allows a ...
0
votes
2answers
24 views

Laravel route pointing outside project directory

So I am new to Laravel. I have a project named Blog created using Composer and placed inside WWW of Wamp server. I am using the following routes Route::get('/', function () { return view('...
0
votes
2answers
23 views

Laravel request is an array but not recognized by count()

I am passing an array into my controller via axios.post request. I am trying to get the length of the $request array that I am passing to the controller. However, I keep recieving a "Parameter must be ...
0
votes
1answer
18 views

HTTP client/ “file_get_contents()” makes Laravel application time out because of loading time

I am currently using Guzzle to fetch data from a resource, and this is inside a Laravel application. The function to fetch the API is located in the function of a controller. Whenever I load a page (...
3
votes
3answers
28 views

Laravel - Convert array back to a collection

I am trying to get a collection of categories only if they are in the products table. My categories table has 300 items. I only want a collection if a category is attached in the products table. The $...
0
votes
1answer
14 views

Can not find autoload.php when running laravel in a docker container

I am trying to run laravel on a docker container. However, I created a docker file to install the required dependencies and extensions. Then, I created a docker-compose file to run the container. But, ...
0
votes
1answer
16 views

How to elimnate the effect of upper- and lower case in database filter - vue - laravel

I have written a filter function that filters by column. I noticed, that when a word is uppercase, it won't give the result if the word is in lowercase. For example: I search the term Paper, I get ...
3
votes
1answer
28 views

Insert statements working when inserting emojis, but throws error when using eloquent

Running the query, INSERT INTO table (ref_id, user_id, role_id, text) VALUES (233, 3, 40, 'Hdhdhdh😜😀😊😃hzhzhzzhjzj 我爱你 ❌') works just fine in Sequel Pro, but when using eloquent, it throws an ...
0
votes
1answer
19 views

How to set a variable within json_contains with raw laravel?

by using (1) I get the wanted result from the laravel request. But as soon as I switch the hardcoded "fish" to an variable like $str = 'fish', I get syntax errors. (1) $find = animal::whereRaw('...
2
votes
1answer
25 views

Getting Undefined property: stdClass::$migration error in Lumen when making a migration

I've built and run 1000 migrations with Laravel/Lumen and I've never seen this happen before. I'm running a dev copy of my application locally, I'm using sqlite with the latest Lumen. This is what ...
1
vote
0answers
11 views

phpWord add chart to location specified by a variable on a template

I'm trying to insert a chart into an existing .docx file, somewhere in the middle of the file. There are other sections where I had to insert numbers generated by my code which I just did using the ${...
1
vote
2answers
35 views

Laravel 5.8 error trying to get the 'id' property of non-object

I'm developing an application with Laravel 5.8. In my application, I have a controller that handles backend articles, and it works. I want to display my user-side information in such a way that a user ...
1
vote
2answers
44 views

Laravel, how can I overwrite code from vendor

Laravel 5.1 has this code: public function postEmail(Request $request) { $this->validate($request, ['email' => 'required|email']); $response = Password::sendResetLink($request->only(...
1
vote
1answer
27 views

Jquery request in Laravel 5.8 not send data - problem with CSRF token

I have this code to dynamic delete files from my list: $(".removeThisFile").click(function () { var id = $(this).attr("id"); $('.file-id-' + id).hide(); $.ajax({ url: '{{ route('...
0
votes
1answer
15 views

Laravel make URL in text output clickable (without escaping)

I'd like to make URLs inside a text output clickable without having to escape the whole output. First I wanted to do it like this, but I would have to escape all of the output which is a security risk....
1
vote
1answer
24 views

How to send web push notification

I have a Angular PWA running Laravel in the back-end as admin panel. I want to send the web push notification to PWA app when admin creates a News at back end. There is no user registration its a ...
0
votes
0answers
11 views

Homestead.yaml file not adding project folder in vagrant | Mac os

I am using mac os and just install vagrant and configured homestead.yaml file but after vagrant up command also tried vagrant reload --provision Also database not created in mysql. Here is my ...
-1
votes
0answers
13 views

Concurrent Booking Handling Using Laravel

I created a shop booking system using laravel. How can I prevent booking the same time by the user? Currently, I put all my codes inside a transaction block but it still inserts booking with the same ...
1
vote
0answers
21 views

Using Laravel Model Factories in C#

So I primarily use C#, but I’ve been watching Adam Wathan’s TDD Laravel course to see what things are like in that world. I came across this idea of a model factory that I haven’t seen material for in ...
0
votes
1answer
32 views

how to Ignore “where clause” if no query is provided with Laravel

I want to get all the leads when the query is empty, but if the 'subService' query is provided then it should fetch all the leads that have the same subService name I am trying to get sub service ...
0
votes
1answer
21 views

How to create directory in Ubuntu using Laravel?

I want to create a directory for each user when they activated their account in laravel Usercontroler. but it doesn't work with below code $path = '/var/www/dngo/files/local/' . $object->id; ...
0
votes
0answers
11 views

How to set two different names for name_type by Relation::morphMap() for only one model according to the conditions?

Relation::morphMap([ 'media' => 'App\Models\IMedia' ]); In IMedia we have videos and photos. I want according to the conditions instead of App\Models\IMedia to be written video or ...
0
votes
3answers
37 views

The DELETE method is not supported for this route. Supported methods: GET, HEAD, POST

I am creating an index form that displays some data. Everything is ready but when I make the delete button I get an error "The DELETE method is not supported for this route. Supported methods: GET, ...
0
votes
2answers
34 views

Undefined property: stdClass::$id for laravel API

I was doing this on laravel using query builder for API $shipments = DB::table('shipment_batches') ->select( "shipments.id as shipment_id", "shipments....
2
votes
1answer
39 views

Access images from storage folder

I upload images to a storage folder storage/app/public but I also add additional folders to store them in a more useful way for me C:\xampp\htdocs\rps\storage\app\public\images\user-profile I ...
3
votes
1answer
29 views

Laravel Policy Guest User

I have the following Policy: <?php namespace App\Policies; use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization; class EventPolicy { use HandlesAuthorization; /** *...
1
vote
1answer
10 views

Laravel5.8 Model Binding Route Arg 1 passed must be an instance of Model

Laravel Project Implemented with Localization and working fine. Making customization as the user can save the language(locale) in DB and here comes the issue. User Able to Save Language in DB. And ...
0
votes
0answers
22 views

at command created from php does not work if created from Laravel

I'm trying to trigger a Laravel command at a specific time, that command is created from a web interface (people can schedule an event to happen). It's not like crontab and the Laravel's Schedule ...
0
votes
0answers
15 views

Elasticsearch\RuntimeException: Failed to JSON encode: 5 in file /Elasticsearch/Serializers/SmartSerializer.php on line 33

I am trying to run a project that uses elasticsearch on my computer. But at the point that the API. Queries something from elasticsearch I get the following error and the query does not execute: ...
1
vote
0answers
26 views

Need to change timezone dynamically for existing project

There is existing project only for one country. Bur for now, it should be used for multiple countries. So I need some common place to change timezones. I decided to update & insert in only London/...
0
votes
2answers
16 views

How to check year in date validation rule in Laravel

In Laravel, I have a Convention object with year, start_date and end_date. The constrain is that the start_date and end_date fields belong to the year field. I wanna use a request validation, but ...
0
votes
1answer
31 views

How to get a specific value from a table in a view when you have conflicting names[Laravel]

Im making an application for a non-profit organisation for a school project and we are using laravel, the first time for me I tried {{$instructiekaart->instructiekaarten.name}} but I get an error ...
2
votes
2answers
59 views

PHP Laravel how to check if checkbox is checked in controller

I'm building a laravel-app where I'm connecting mailchimp to the contact-form. The user has to accept conditions and has the possibility to receive the newsletter by checking a checkbox. Right now, ...
0
votes
0answers
13 views

How to detach image out of textarea in tinymce

I am using tinymce for posting (laravel framework) . I want to detach image and show it in another place (such as the bottom of textarea, not in textarea) when I paste an image to textarea. Addition, ...
1
vote
3answers
35 views

How can I transform a Laravel requested object from a query to int

i'm obtaining a whole object from the database using a Laravel query and an array with a simple query (see the following image) public function editgamemenu($id){ $game = Game::find($id); $...
1
vote
0answers
23 views

Alternate of with clause in query builder in laravel

I write a query using Eloquent in laravel 5 in which i use with Clause but when i write the query in laravel query Builder in which i cannot find any with Clause Please tell me the alternate of with ...
0
votes
1answer
19 views

Laravel, page has to load and then shows the image

I need your help. In my web page, after page load, the image has to wait some seconds and then it is shown. But this is not user-friendly. How can I handle this situation? I don't want to use the ...
0
votes
0answers
20 views

LARAVEL - eloquent get relation with null ids

I am working on some eloquent query. So the idea is that I have 2 models, let's call it Files and Pricing. Files hasMany so in pricings table I have file_id field. But I have default prices in ...
0
votes
0answers
16 views

How can I remove public directory on laravel

I using laravel 5.8 when I upload my project on shared hosting I renamed server.php to index.php in document root and my htaccess in /public_html is like that: Options -MultiViews ...
-2
votes
3answers
28 views

Export CSV Cannot use object of type stdClass as array

i want to export data from my json to csv file but i get this error Cannot use object of type stdClass as array i want to know please how i can use it as array public function exportUsers() { ...
0
votes
3answers
14 views

foreign key laravel migration

This is my students migration and I want to have foreign key in it named subject_id: public function up() { Schema::create('students', function (Blueprint $table) { $table->...
0
votes
0answers
2 views

how to use snappy pdf with yajra datatables

blade view Which contain a datatable inside of it and i want to export that view to pdf i tried to put this line before the end of Config/datatables.php 'pdf_generator' => 'snappy' and ...
0
votes
1answer
14 views

How to solve this error in blockchain and PHP

Access to XMLHttpRequest at 'https://chain.so/api/get_address_balance/BTCTEST/undefined' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is ...
-1
votes
2answers
25 views

Validate files in Laravel 5.8

I have validation: if ($request->hasFile('otherFiles')) { $this->validate($request, [ 'otherFiles' => 'mimes:image/jpeg' ]); } How can I add ...
0
votes
3answers
20 views

Route [profile.store] not defined

My Form tag is <form action="<?php echo route('profile.store'); ?>" method="post"> <input type="hidden" name="_token" id="csrf-token" value="<?php echo csrf_token(); ?>" /> ...
0
votes
0answers
30 views

Storing custom path to images

I am using quite complicated path for user images which is: \public\files\assets\images\user-profile My question is, can I store it somewhere in laravel, maybe in .env file or sth and store it there ...
0
votes
2answers
40 views

Vuejs page loads before axios request returns data

Problem Im trying to load data from my database using vuejs + axios in a Laravel project. Locally I can make the request using axios and it returns the data, assigns it to variables and then outputs ...
0
votes
0answers
16 views

Laravel 5.4 admin panel

I'm creating website that user can register and login to it so I want to create admin panel for add or delete user or edit user while user can login only how can I do that
0
votes
0answers
16 views

deleteFileAfterSend Laravel response doesn't delete file in tests

I an have laravel 5.5 App. I'm trying to make a test for download PDF with laravel snappy. So far I have in my CheckTest.php one function: public function testPrintCheck(){ $check = $this->...