laravel-5.4

Laravel 5.4 field doesn't have a default value

安稳与你 提交于 2019-12-20 17:31:45
问题 I am having this error and none of the googled result i checked is similar to my problem. I have an application with class Deal, User, and Matches A deal has many matches. A user has many matches. A user has many deals. I am attempting to create a new Match using my Deal object $deal->matches()->create(['user_id'=>$id]); This is my match class, i have defined all needed relationships class Match extends Model { /** * The attributes that are mass assignable. * * @var array */ protected

Laravel 5.4 field doesn't have a default value

此生再无相见时 提交于 2019-12-20 17:31:44
问题 I am having this error and none of the googled result i checked is similar to my problem. I have an application with class Deal, User, and Matches A deal has many matches. A user has many matches. A user has many deals. I am attempting to create a new Match using my Deal object $deal->matches()->create(['user_id'=>$id]); This is my match class, i have defined all needed relationships class Match extends Model { /** * The attributes that are mass assignable. * * @var array */ protected

how to manage a special error with special message in laravel

穿精又带淫゛_ 提交于 2019-12-20 05:38:14
问题 I'm using laravel 5.4. and I need handle some error. imagine user logged in and opened two windows (his profile). When user click on logout in a window, we have still logout button in another window, and by clicking on that, laravel will show csrf_token error page. My logout in not ajax and its with submitting a form to /logout how can I handle this error with special message or redirect to home without error from logout controller? (not all of csrf_token errors, just from that controller).

Laravel Login with www. and without

会有一股神秘感。 提交于 2019-12-20 05:18:08
问题 I have a Laravel 5.4 App I created on a Ubuntu 14.04 with NGINX and it runs fine on https://MyDomain.TLD and https://www.MyDomain.TLD The problem is: When I log in either(with or without www), it works fine but cookie informations are not shared to the other variant. I did not have an issue with this in previous versions of Laravel 5+ . Any pointers? 回答1: You need to handle www because session is saving based on domain, so try adding below code into .htaccess file, one is for force

how to do LOAD DATA LOCAL INFILE in laravel 5.4

爷,独闯天下 提交于 2019-12-20 04:38:29
问题 i need to convert the following query in laravel 5.4 $loadDataToTempTableSql = "LOAD DATA LOCAL INFILE '".$filename."' INTO TABLE ABC FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\r' IGNORE 1 LINES"; $loadDataToTempTableRes = mysqli_query($link,$loadDataToTempTableSql); $loadedData = mysqli_affected_rows($link); what i did Step1: DB::select($load_data_to_temp_table_sql); which is throwing exception: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while

Laravel 5.4 - How to override route defined in a package?

强颜欢笑 提交于 2019-12-18 15:51:43
问题 I have created a package in Laravel 5.4 that sets up a basic backoffice. This package contains several routes that are using controllers from within the package. What I want to be able to do is to override the package defined routes in my application in order to plug custom controllers. For example, if I have a route Route::get('login', [ 'as' => 'admin.login', 'uses' => 'Auth\LoginController@showLoginForm' ]); defined in my package that will use the Vendor\Package\Controllers\Auth

Laravel 5.4 passport axios always returns Unauthenticated

元气小坏坏 提交于 2019-12-18 05:06:12
问题 I've followed the guide here:https://laravel.com/docs/5.4/passport#consuming-your-api-with-javascript Using axios: ... mounted: function() { axios.get('/api/user') .then(function (response) { console.log(response) }) .catch(function (response) { console.error(response); }); }, But the response is always unauthenticated, I check to see if a laravel_token cookie is present and it is: I'm running on apache2 ( docker ) ---- Update -- Upon debugging, its actually the xsrf token thats failing in

PHPunit Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()

柔情痞子 提交于 2019-12-18 02:17:13
问题 i don't know if it's related to Laravel 5.4. when i run phpunit command after installing laravel 5.4 without making any changes i get Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() but when i run php artisan dusk it runs normally c:\xampp\htdocs\ublocker>phpunit PHP Fatal error: Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI

How to upload files in Laravel directly into public folder?

给你一囗甜甜゛ 提交于 2019-12-17 19:12:49
问题 The server which I'm hosting my website does not support links so I cannot run the php artisan storage:link to link my storage directory into the public directory. I tried to remake the disk configuration in the filesystems.php to directly reference the public folder but it didn't seems to work either. Is there a way to upload a file using Laravel libraries directly into the public folder or will I have to use a php method? Thanks in advance. 回答1: You can create a new storage disc in config

Registering User with Laravel Passport

帅比萌擦擦* 提交于 2019-12-17 10:37:25
问题 I set up password grant (it's backend for an app). Now, I can send a post request to oauth/token and it works on Postman. However, what if I want to register user from the api too? I understand I can use current /register route, however, then will I need to redirect the user back to the login page and he logs in again with his credentials? Or in the RegisterController, in registered() function, should I do I redirect to the oauth/token route? (For this, please note that I am sending, all the