laravel

Laravel + Nuxt + Nginx: WebSocket is closed before the connection is established

江枫思渺然 提交于 2021-02-08 06:38:48
问题 General scheme and project configuration files The project consists of two parts: Server part - Laravel (api) Customer part - NuxtJs (client) A minimum project configuration has been prepared for the test: Laravel Websockets packages have been installed: beyondcode/laravel-websockets: https://beyondco.de/docs/laravel-websockets/getting-started/introduction pusher/pusher-php-server: https://pusher.com/tutorials/web-notifications-laravel-pusher-channels File composer.json : ... "require": {

Laravel mix, call app.js in resources

孤街浪徒 提交于 2021-02-08 06:15:09
问题 I have a web app with laravel and vuejs. I use laravel-mix and in my webpack.mix.js I have: mix.js('resources/assets/js/app.js', 'public/js') In the view I have <script src="{{mix('js/app.js')}}"></script> But it still does not run, I think it could be interfered by <base href="{{asset('')}}"> card. I run npm run watch but still no error message. In my website app.js can run but the other libraries get lost. 回答1: I always do these steps and it works please try these: 1)install laravel mix npm

Laravel: Apache alias for URLs with trailing slash

巧了我就是萌 提交于 2021-02-08 05:31:11
问题 I have a Laravel website in directory /home/user/Documents/laravel-training . I would like to visit my website from http://localhost/dev/ , so I set an alias in /etc/apache2/sites-enabled/000-default.conf . Here is my 000-default.conf : <VirtualHost *:80> ServerName foo.example.net ServerAdmin foo@example.org DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /dev /home/user/Documents/laravel-training/public <Directory /home

Custom login password check with Laravel 5.4

感情迁移 提交于 2021-02-08 04:49:18
问题 If a user tries to log into my Laravel application and the password won't match with the "password" column in the database, I want to check it against another password column ("old_system_password") too. I'm using the default Laravel authentication system, and as far as I understand I should be able to create a new "AuthController" and override the built in authentication methods. But I don't find any methods dealing with password matching in the vendor folder, and neither do I know how to

Custom login password check with Laravel 5.4

旧巷老猫 提交于 2021-02-08 04:48:39
问题 If a user tries to log into my Laravel application and the password won't match with the "password" column in the database, I want to check it against another password column ("old_system_password") too. I'm using the default Laravel authentication system, and as far as I understand I should be able to create a new "AuthController" and override the built in authentication methods. But I don't find any methods dealing with password matching in the vendor folder, and neither do I know how to

Laravel Eloquent Pluck produced incorrect data

余生颓废 提交于 2021-02-08 04:10:55
问题 Trying to get created_at date using pluck. $campaigns_dates = CampaignHistory::where('status', "Complete")->orderBy( 'created_at', 'ASC' )->pluck('created_at'); $campaigns_dates = json_decode( $campaigns_dates ); return $campaigns_dates; //Getting This ["2020-06-29T14:19:03.000000Z","2020-06-29T14:19:42.000000Z","2020-07-29T14:23:54.000000Z","2020-08-28T14:55:53.000000Z","2020-08-29T14:17:40.000000Z","2020-09-29T14:18:27.000000Z","2020-09-29T14:21:13.000000Z"] //But Want This Example: ["2020

laravel belongsToMany Filter

て烟熏妆下的殇ゞ 提交于 2021-02-08 04:10:45
问题 I have three tables as below: users id|name|username|password roles id|name users_roles id|user_id|role_id These tables communicate via belongsToMany. I would like to find a way to select all data in “users” table except ones that their user value of "role_id" is 5 in table “users_roles”. How can I do it? 回答1: You should use whereDoesntHave() to select models that don't have a related model meeting certain criteria: $users = User::whereDoesntHave('roles', function($q){ $q->where('role_id', 5)

laravel belongsToMany Filter

那年仲夏 提交于 2021-02-08 04:10:32
问题 I have three tables as below: users id|name|username|password roles id|name users_roles id|user_id|role_id These tables communicate via belongsToMany. I would like to find a way to select all data in “users” table except ones that their user value of "role_id" is 5 in table “users_roles”. How can I do it? 回答1: You should use whereDoesntHave() to select models that don't have a related model meeting certain criteria: $users = User::whereDoesntHave('roles', function($q){ $q->where('role_id', 5)

Laravel 5.4 - Reset Password change “email” column

浪子不回头ぞ 提交于 2021-02-08 03:53:21
问题 I'm working with differing versions of Laravel and have built an addon that uses Laravel 5.4, Which unfortunatley is using a DB that references Laravel 3 sic The " users " table has a column titled " user_email ". On the reset password, I want to change the DB Query to check against "user_email" not "email". As I currently get the error : SQLSTATE[42S22]: Column not found: 1054 Unknown column 'email' in 'where clause' SQL Query that it's trying to run is : SQL: select * from `users` where

Laravel sync Relation with optional parameters

那年仲夏 提交于 2021-02-08 03:39:26
问题 I use the sync function for syncing a belongsToMany Relation: $model->products()->sync($productIds); In the $productIds array there is flat array with some Id's - something like this: $productIds = [1,3,5,6]; What I want: The pivot table has also additional columns like "created_by" and "updated_by". But how can I add these fields to my array WITHOUT doing a foreach loop? Is there a shorter way to do this? I need an array like this: $productIds = [1 => [ 'created_by' => 1, 'updated_by' => 1 ]