laravel-6

Laravel 6 - login with Phone or Email

天涯浪子 提交于 2020-02-06 08:47:13
问题 I'm using Laravel 6 and want user can alternatively login by email or mobile. My attempts so far: Migration is working fine. Registration is working fine Login works fine one at a time either email or mobile with below changes in loginController.php. public function username() { return 'mobile'; // or email } and also login.blade.php for HTML forms from email to mobile. I tried to validate both email and phone by @error directive , like @error('email') || @error('mobile') is-invalid @enderror

Eloquent whereRaw is not working with bindings

旧城冷巷雨未停 提交于 2020-02-04 13:48:10
问题 I have a json column in my database with french characters. So when I use: App\Job::where('name->fr', 'like', '%Fune%')->count(); It is not finding results for jobs that has an accent in the name like Funéraire . I can accomplish what I want by adding a collate in the query using the whereRaw : App\Job::whereRaw('json_unquote(json_extract(`name`, \'$."fr"\')) LIKE \'%Fune%\' collate utf8mb4_general_ci')->count(); However, when I use bindings in my whereRaw method: App\Job::whereRaw('json

Laravel 6.0.3 Not Loading Key Resources App.js or App.css 404 Not Found

若如初见. 提交于 2020-02-03 08:13:26
问题 To setup my project I ran: laravel new cms composer require laravel/ui php artisan ui:auth php artisan migrate However, when I go to http://cms.test/login I am shown the login page: And get two 404 errors for missing resources: http://cms.test/js/app.js net::ERR_ABORTED 404 (Not Found) http://cms.test/css/app.css What could be the reason for these missing files? My public directory is empty aside from .htaccess, favicon.ico, index.php and robot.txt files, is that normal? 回答1: My setup was a

How to pass a PSR-6 compliant cache adapter in Laravel 6.X?

限于喜欢 提交于 2020-01-25 07:25:47
问题 I note there is a cache.psr6 container alias but if I use: new Cache As the instance, I get an error that getItems isn't available, which, I assume, means I am not passing a PSR-6 compliant cache instance. I'm using Redis if that changes the config in any way. Is there an additional configuration to be done or am I passing this the wrong way? The library I am using is: https://github.com/AlexaCRM/dynamics-webapi-toolkit/wiki/Tutorial And the tutorial states: You can optionally supply a PSR-6

How to fix foreign key error when running migration

放肆的年华 提交于 2020-01-22 02:31:08
问题 I don't know why it's still don't work and show this: Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1005 Can't create table db_rocnikovka . books (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table books add constraint books_doba_foreign foreign key ( doba ) references druh_knihies ( id_druhu )) at C:\xampp\htdocs\Rocnikovka\vendor\laravel\framework\src\Illuminate\Database\Connection.php:665 Exception trace: 1 PDOException::("SQLSTATE[HY000]:

Artisan command “make:auth” is not defined in Laravel 6

十年热恋 提交于 2020-01-19 01:24:09
问题 I have a problem when creating login/auth in Laravel 6. I typed "make: auth" in the terminal and I get an error "Command" make: auth "appears not defined." Is there a solution for this? 回答1: Looks like L6 moves the Auth scaffolding into a separate package. https://laravel.com/docs/6.0/authentication Want to get started fast? Install the laravel/ui Composer package and run php artisan ui vue --auth in a fresh Laravel application. 回答2: https://laravel.com/docs/6.0/authentication#included

Laravel - Change locale using Ajax

巧了我就是萌 提交于 2020-01-11 12:27:17
问题 I am trying to change the language of my system using ajax but I don't know how to change the locale and make it permanent until the user decides to change again. Currently, the locale in the app.php is set to 'en' and I want to change it to 'nl' using a select menu. I tried using App::setLocale($value) but that does not do anything, unfortunately. How can I accomplish this? Form <form method="POST" action="{{ route('change_language',['id' => Auth::user()->id]) }}" class="form-row my-3"> {{

ConfirmPasswordController doesn't exist after upgrade from Laravel 5.8 to 6.2

删除回忆录丶 提交于 2020-01-03 08:28:10
问题 I am working on a project which is in Laravel 5.8, and recently, I upgraded it to Laravel 6.0 with its packages dependencies versions too. The project was running fine. But, today, I update the composer via composer update, and it upgraded to Laravel 6.2. After that, I faced an error: App\Http\Controllers\Auth\ConfirmPasswordController does not exist Then I installed a fresh Laravel-6.2 and generated basic scaffolding via php artisan ui vue, then, generated login/registration scaffolding via

ConfirmPasswordController doesn't exist after upgrade from Laravel 5.8 to 6.2

孤人 提交于 2020-01-03 08:28:04
问题 I am working on a project which is in Laravel 5.8, and recently, I upgraded it to Laravel 6.0 with its packages dependencies versions too. The project was running fine. But, today, I update the composer via composer update, and it upgraded to Laravel 6.2. After that, I faced an error: App\Http\Controllers\Auth\ConfirmPasswordController does not exist Then I installed a fresh Laravel-6.2 and generated basic scaffolding via php artisan ui vue, then, generated login/registration scaffolding via

How to override env variables in Laravel Dusk

爷,独闯天下 提交于 2019-12-29 02:09:45
问题 Unfortunately config(['key' => 'newValue']) doesn't work in a Dusk setup (for overriding a config value), presumably because it would change the config of the system running the test rather than the experience of the headless browser that gets opened to execute the flow. And sometimes I can see no way around needing to temporarily change an env value for a certain Dusk test. E.g. temporarily set QUEUE_DRIVER=sync when usually it is 'dusk-connection', but in one particular test, I need to