laravel

React Router does not recognize direct address line changing in laravel

我的未来我决定 提交于 2021-01-28 08:40:43
问题 I use React Router and Laravel. When I navigate throught Link elements all OK, but when I change browser address line to manually show another component Laravel shows it defalt 404 page. This is default web.php content, in welcome.blade.php I inlcude js/app.js file: Route::get('/', function () { return view('welcome'); }); This is my App.js content: import React from 'react'; import { Switch, Route } from "react-router-dom"; import Signin from "../../containers/Signin"; import Signup from "..

Issue in laravel/lumen query builder whereColumn method

爷,独闯天下 提交于 2021-01-28 08:30:41
问题 Lumen Version: 5.5 PHP Version: 7.0 I wrote following code to update data by using whereColumn method: Ratings::whereColumn([['class_id', '=', $class_id], ['id', '=', $rating_id]])->update(['grade' => $grade, 'star' => $star, 'comment' => $comment]); which generate a SQL error: SQLSTATE[42S22]: Column not found: 1054 Unknown column '1' in 'where clause' (SQL: update \`ratings\` set \`grade\` = 16级学生, \`star\` = 4, \`comment\` = very good where (\`class_id\` = \`1\` and \`id\` = \`6\`)) it

many-to-many relationship OrderBy - Laravel query builder

回眸只為那壹抹淺笑 提交于 2021-01-28 08:27:38
问题 I am trying to order products by thp price in options table the price can be in multi currency for that i add dolor_price calculated as code below. but the result was the following Error SQLSTATE[42S22]: Column not found: 1054 Unknown column 'options.dolor_price' in 'order clause' $products=Product::with(["options"=> function($option){ $option->where('name' ,'unique name' ); $option->selectSub(function ($q) { $rateEruToDolor =2; $rateAedToDolor =3; $q->selectRaw(' IF(currency=0,price * ?, IF

Laravel Seeding missing classes

為{幸葍}努か 提交于 2021-01-28 08:21:04
问题 I am following this tutorial until I need to generate seeds using: php artisan db:seed . It always said that my Article and User class are not found. I have looking for solution like in: https://laracasts.com/discuss/channels/lumen/unable-to-run-php-artisan-dbseed-due-to-missing-class (setting up composer.json's auto load paths and composer dump-autoload ) Laravel cannot find class of a package I have deleting my vendor folder and do composer install again Also importing the file manually,

Forcing locale in Laravel Dusk

橙三吉。 提交于 2021-01-28 08:04:42
问题 How can we force the locale used by Dusk within our tests? The browser is launched with FR locale set and thus my application is outputting French. I would need to make all tests consistently, regardless of the locale set by the developer on his system when running tests. In the middleware stack, I have a LocaleMiddleware responsible for picking a locale based on the request headers (sent automatically by the browser). If possible, I would like to avoid having test-specific code within the

How to login with Crypt encryption in login controller

百般思念 提交于 2021-01-28 08:03:39
问题 I am using Crypt:: for registration and login. My registration is successful but login is not successful. Please check the code and help me. public function Login(Request $request) { $this->validate($request, [ 'email' => 'required', 'password' => 'required', ]); $userdata = array( 'email' => $request->email, 'password' => \Crypt::encrypt($request->password) ); if (Auth::attempt($userdata) { echo "success";die(); } return "Ops! snap! seems like you provide an invalid login credentials"; } 回答1

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row (Laravel 6)

纵饮孤独 提交于 2021-01-28 08:02:20
问题 What am I doing wrong? Environment: Laravel 6, Homestead (Local), Windows 10 Create External Table (Migration): Schema::create('external', function (Blueprint $table) { $table->increments('id')->unsigned(); $table->foreign('id')->references('order_id')->on('order'); }); Create Order Table (Migration): Schema::create('order', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('order_id')->index(); External.php (model): class External extends Model public function

exec() function within Laravel works wrong, in tinker and console properly

懵懂的女人 提交于 2021-01-28 08:00:48
问题 I have a weird problem with exec function within the Laravel app. Using imagemagick library I have to combine two pdf files - the same shell command works properly in terminal, exec() with this command in tinker works properly too. However, when called from job or controller within the Laravel app it looks like it is not seeing the original file at all. What can be the reason? All files are stored in generated storage subfolders. works properly in tinker works properly in terminal works

how can I check my old password with new password

放肆的年华 提交于 2021-01-28 07:56:55
问题 I am using bcrypt() function for storing my password of a user. Now if a user wants to change his/her password, then he/she will put his old password and I will check that with old password. Problem is whenever I am using bcrypt function to the user inputed password it shows some new generated password. Ex: During registration a user registered with 111111 password. And during change password the user also inputing 111111 but the both comes different. Q: Why it shows different. I am using

Monthly recurring event on specific date and skip any month if have less no of days compare to user's selected date

有些话、适合烂在心里 提交于 2021-01-28 07:41:16
问题 I am creating a app where user can create monthly event (Just like Google/Outlook), so if user has selected 31st date of any month and next month have 30 days than all next dates are changing to 30th . Same goes with 30th , lets say user selected 30th of December than after Feb all next date is changing to 28th . so if in next month days are lesser than user's selected date its changing the date to that. Example : Start Date : 2020-10-31 End Date : 2021-11-30 $diffInMonths = $startDate-