laravel

Laravel 6 pathinfo() expects parameter 1 to be string, object given

好久不见. 提交于 2021-01-29 08:44:33
问题 This is where i get the error: $data = Excel::import($path, function($reader) {})->get(); I changed the load() to import() . I want to run this code in Laravel 6, but version 3 of MaatWebsiteExcel does not support load() . I've been searching for solutions, yet i cant find any.... This is my controller: namespace App\Http\Controllers; use App\Contact; use App\CsvData; use App\Http\Requests\CsvImportRequest; use Illuminate\Http\Request; use Maatwebsite\Excel\Facades\Excel; use Session; use DB;

How to deploy laravel project on the godaddy hosting server (Plesk Onyx CPanel)

可紊 提交于 2021-01-29 08:36:24
问题 I currently new for deploying a project files to the godaddy hosting sites, so before i post this, I read some related question created already here in stackoverflow, I just confuse because there cpanel has public_html folder and my panel has no public html. so right now I experience HTTP Error 404. The requested resource is not found. The things only I do is to move the laravel files in the httpdocs. My CPanel : Plesk Onyx 17.8.11 For the folder structure: So Inside of httpdocs are all of my

How to update image with PUT method in Laravel REST API?

耗尽温柔 提交于 2021-01-29 08:31:09
问题 I am trying to build a REST API with Laravel where users need to update their image. But, If I use PUT method in postman it does not update the image or store the image in designated folder. If I use POST instead it does update the image and also saves in the folder. But it does not save the file in database as I customize the name to store in DB. What could be the reason. Help is really necessary. TIA. Update Code public function update(Request $request, $id) { $found = Partner::find($id);

laravel 8 instalation error - npm run dev throws error

旧时模样 提交于 2021-01-29 08:30:12
问题 I am trying to install a fresh laravel 8 project. After downloading frontend scaffolding when I try to run npm run dev it gives me an error. This problem also happens during installing jetstream in this npm run dev . I am giving error below. unkno@DESKTOP-NAP4DRR MINGW64 /c/laravel projects/example $ npm run dev > @ dev C:\laravel projects\example > npm run development > @ development C:\laravel projects\example > mix [webpack-cli] Running multiple commands at the same time is not possible

Laravel, error when running npm run dev on fresh new installation

百般思念 提交于 2021-01-29 08:25:57
问题 I've just created a new laravel 8 project, but I have an issue when running npm install and npm run dev, more specifically when running npm run dev. I've never had this issue before, and hadn't made any changes to my NodeJs or something like that. I was able to compile my dependencies without any error, but today I encountered this error. Here's the output. Admin@DESKTOP-KH5JMQG MINGW64 /c/Proyectos Web/Dashboarding $ npm install npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on

Optimising Laravel query

眉间皱痕 提交于 2021-01-29 08:11:52
问题 Picked up Laravel recently for an API project and have got it all set up and working, and Ive been migrating an API written from a php function with a concatenated SQL string into Laravel query builder, all is fine apart from one part. I have a table of stock, and a features table, so I have defined a hasMany relationship on the model of stock to the features, and when I pass in a string array of features to the query I need to loop over each feature and then get back all the stock items that

Laravel API JSON customization and table relationship

允我心安 提交于 2021-01-29 08:09:08
问题 I'm developing a social media project using Laravel. I need to provide a customized API for Follows and Followers. Accordingly, I want to establish a relationship between the user table and the followers and followed tables. I have looked at a lot of resources but get confused. Can anyone help me with relationships? Models Users: id, username, email, password Follows: id, user_id, follow_id(user_id) Followers: id, user_id, follower_id(user_id) API Url: http://localhost/api/follows/user_id/1

Multi session tables in Laravel

梦想的初衷 提交于 2021-01-29 07:53:01
问题 i have setup a Laravel project with two guards wach with Hi own users table. Now i want to save the sessions into the database instead in a file. The Problem is that I cant save the session in a single table, because the user ID is not unique. How can I solve this problem? Thanks. 回答1: I tried this. This working, but it exists a default session driver, so a user has a session in the default table and in the admin_sessions table. class AuthServiceProvider extends ServiceProvider { protected

How to Authenticate the data from Microsoft Azure AD using Laravel and redirect it to Home?

℡╲_俬逩灬. 提交于 2021-01-29 07:52:06
问题 I'm trying to authenticate Microsoft Azure AD with my laravel web app. Currently I'm referring Azure Active Directory SSO with Laravel. I managed to retrieve the data from the microsoft azure ad but the problem is it doesn't redirect to /home view instead it redirect to login view. I have one idea which is to link the email from Microsoft and email from the model so that it can directly go to home page. But i dont know how to pass the Microsoft data (from provider) to controller. The code(in

laravel model class not found

血红的双手。 提交于 2021-01-29 07:48:11
问题 I'm getting class model not found error In my model class namespace App\models; use Illuminate\Database\Eloquent\Model; class Customer extends Model { protected $table = 'customers'; } And in my controller namespace App\Http\Controllers; use Illuminate\Http\Request; use \app\Models\Customer; use Illuminate\Support\Facades\Input; class RoomsController extends Controller { public function index() { $room= Customer::all(); return view('rooms',compact('room')); } } I even tried composer dump