laravel-5.4

Laravel 5.4, show error message auth login when user is not active

拈花ヽ惹草 提交于 2019-12-10 10:24:56
问题 My focus is to show the user an error message called "You are inactive or not activated yet", if a user is tried to login with valid credentials but his status field is 0 ( Inactive ). I am able to redirect a user to login page if his/her status is inactive by below function in LoginController. protected function credentials(\Illuminate\Http\Request $request) { return ['email' => $request->{$this->username()}, 'password' => $request->password, 'status' => 1]; } How can I achieve this in

“Unknown database type json requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.” while running php artisan migrate command

不羁岁月 提交于 2019-12-10 09:32:30
问题 When I run: php artisan migrate and want to modify a string field to a text field like this: //the old field that i want to modify in migration file $table->string('description')->nullable(); //and the new text field $table->text('description')->change(); I get the following error: Unknown database type json requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it. 回答1: try this solution may be this will work for you, public function __construct() { DB::getDoctrineSchemaManager()

Dropzone createThumbnailFromUrl() issue

蓝咒 提交于 2019-12-10 04:33:42
问题 I need to add pre-existing image files to dropzone by using Laravel 5.4 . This is why I use createThumbnailFromUrl() function. But it does not generate images properly. Instead it shows them in blank way. I used that link (jsfiddle) for that purpose. I googled a lot, tried several ways, but it did not help: Below is my code: <script type="text/javascript" src='{{asset("js/dropzone/min/dropzone.min.js")}}'></script> <script type="text/javascript"> Dropzone.options.addImages = { paramName:

Trying to get property of non-object ErrorException Laravel

喜夏-厌秋 提交于 2019-12-09 23:50:56
问题 I'm new to laravel and created a mini program using a bit of help of twitter bootstrap. I'm trying to access this route: http://127.0.0.1:8000/posts/create And I get these errors : 2/2 ErrorException in 73427cb411f683691ba00d0846f7eda3c61bff74.php line 4: Trying to get property of non-object (View: C:\xampp\htdocs\laravel\alquirozlaravel\resources\views\show-solo.blade.php) in 73427cb411f683691ba00d0846f7eda3c61bff74.php line 4 at CompilerEngine->handleViewException(object(ErrorException), 1)

Laravel Passport 404

左心房为你撑大大i 提交于 2019-12-09 18:58:43
问题 I installed Laravel Passport using the Laravel docs, the Laravel version is 5.4. Everything worked fine so far now I add these lines into my view: <!-- let people make clients --> <passport-clients></passport-clients> <!-- list of clients people have authorized to access our account --> <passport-authorized-clients></passport-authorized-clients> <!-- make it simple to generate a token right in the UI to play with --> <passport-personal-access-tokens></passport-personal-access-tokens> The Ui

How to secure .env file in laravel 5.4?

被刻印的时光 ゝ 提交于 2019-12-09 18:42:34
问题 I am Working with laravel 5.4. And i have problem with .env and composer.json file. Anyone can access from any browser and anyone can see my database credentials so please help me to protect this files. 回答1: Remember that once your server is configured to see the public folder as the document root, no one can view the files that one level down that folder, which means that your .env file is already protected, as well your entire application. - That is the reason the public folder is there,

Laravel 5 Unit Test - Call to a member function connection() on null

喜夏-厌秋 提交于 2019-12-09 11:24:46
问题 I tried creating a unit test for the relationships between my User and Shop models, however when I run vendor\\bin\\phpunit this error(s) are thrown, I have no idea about this since I'm a newbie in unit testing. I tried to run my code on my controller to see if the relationship actually works, and fortunately it is working as expected, but not when run in phpunit. What have I done wrong for this phpunit not to work with Models? Fatal error: Uncaught Error: Call to a member function connection

Changing Laravel 5.4 password encryption and table column names

让人想犯罪 __ 提交于 2019-12-09 06:35:14
问题 I am trying to integrate the auth in laravel 5.4 within an existing database where the user and password fields have other names ( memberid , passwordnew_enc ). With the bellow changes and forcing the create function in RegisterController to use MD5 I managed to make the registration work. It also logins fine after registration. However the actual login form returns: These credentials do not match our records. So far I have changed the User.php public function getAuthPassword() { return $this

How to run multiple Laravel projects at same time?

◇◆丶佛笑我妖孽 提交于 2019-12-09 05:47:42
问题 To run one laravel project we only need to type "php artisan serve". and it will be available on port 8000. But sometimes we need to run multiple projects at the same time. How can we do this? 回答1: tl;dr one cannot have more than one listener per TCP port at the same time. If you need more web server instances try another port: php artisan serve --port=8001 then go to http://localhost:8001 Reference: Can two applications listen to the same port? 回答2: You can also run web server on multiple

Laravel 5.4 Upgrade — Integrity constraint violation - Column cannot be null

我怕爱的太早我们不能终老 提交于 2019-12-09 03:56:19
问题 The strange thing is -- all of this was working at 5.2, but I don't know what could have changed to make this happen. Below is the error and the array being inserted. SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'gender' cannot be null (SQL: insert into `tenants` (`name`, `phone`, `email`, `description`, `gender`, `date_birth`, `background_check_status`, `picture_url`, `work`, `position`, `country`, `location`, `hobbies`, `updated_at`, `created_at`) values (Amadeo Levy Luna,