laravel-5.4

Auth::viaRemember() doesnot work (means always return false even after successful login) in laravel 5.4

自闭症网瘾萝莉.ら 提交于 2021-02-08 10:16:15
问题 I make use of php artisan make:auth in laravel 5.4, as we know laravel default login only supports email so, I put login() in AuthController like below (login working)- public function login(Request $request) { $remember = ($request->input('remember')=='1')?true:false; // this will remember the user as given in laravel documentation. if (Auth::attempt(['user_name' => $request->user_name, 'password' => $request->password],$remember)) { return redirect()->intended('admin'); } elseif (Auth:

Edit db record with modal window

。_饼干妹妹 提交于 2021-02-08 07:58:53
问题 I'm trying to edit some database record based on an ID that I'm saving into a button value. @foreach ($employment as $empl) <button data-toggle="modal" data-target="#edit-empl" href="#edit-empl" class="btn btn-default editbtn-modal" value="{{ $empl->id }}" type="button" name="editbtn">Edit</button> <h3 class="profile-subtitle">{{ $empl->company }}</h3> <p class="profile-text subtitle-desc">{{ $empl->parseDate($empl->from) }} - {{ $empl->parseDate($empl->to) }}</p> @endforeach As you can see

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

How to handle multiple elements with the same class in laravel dusk

冷暖自知 提交于 2021-02-07 20:33:56
问题 In my dusk test I want to firstly add and then delete news. Each news has .delete-news class but on the screen I have multiple elements. Each .delete-news class has in it's path data attribute with it's id data-newsid="id" . Now the browser does not know which delete-news class it should to click. How should I manage that? Probably I should take delete-news class with the biggest data-newsid attribute. But I don't know how I should check it. Currently I'm deleting it like this: public

How to handle multiple elements with the same class in laravel dusk

安稳与你 提交于 2021-02-07 20:32:44
问题 In my dusk test I want to firstly add and then delete news. Each news has .delete-news class but on the screen I have multiple elements. Each .delete-news class has in it's path data attribute with it's id data-newsid="id" . Now the browser does not know which delete-news class it should to click. How should I manage that? Probably I should take delete-news class with the biggest data-newsid attribute. But I don't know how I should check it. Currently I'm deleting it like this: public

How to handle multiple elements with the same class in laravel dusk

拜拜、爱过 提交于 2021-02-07 20:31:42
问题 In my dusk test I want to firstly add and then delete news. Each news has .delete-news class but on the screen I have multiple elements. Each .delete-news class has in it's path data attribute with it's id data-newsid="id" . Now the browser does not know which delete-news class it should to click. How should I manage that? Probably I should take delete-news class with the biggest data-newsid attribute. But I don't know how I should check it. Currently I'm deleting it like this: public

Laravel 5.4 - How to use multiple error messages for the same custom validation rule

旧街凉风 提交于 2021-02-07 05:19:44
问题 In order to reuse code, I created my own validator rule in a file named ValidatorServiceProvider : class ValidatorServiceProvider extends ServiceProvider { public function boot() { Validator::extend('checkEmailPresenceAndValidity', function ($attribute, $value, $parameters, $validator) { $user = User::where('email', $value)->first(); // Email has not been found if (! $user) { return false; } // Email has not been validated if (! $user->valid_email) { return false; } return true; }); } public

Laravel Timestamp Being Updated Without Explicit Call To Do So

最后都变了- 提交于 2021-02-04 07:32:43
问题 So I'm running into an annoying problem with Laravel update and save. I have a model/table Invoice and invoices , that has a timestamp sent_at . Invoice.php class Invoice extends Model { protected $dates = [ "sent_at", ]; } I have the following function that updates the Invoice : InvoicesController.php : public function postPayInvoice(Request $request, $invoiceId){ $user = $this->apiResponse->user; $invoiceItemIds = $request->input("invoice_item_ids"); $invoice = Invoice::with(["invoiceItems"

Laravel Timestamp Being Updated Without Explicit Call To Do So

大憨熊 提交于 2021-02-04 07:31:45
问题 So I'm running into an annoying problem with Laravel update and save. I have a model/table Invoice and invoices , that has a timestamp sent_at . Invoice.php class Invoice extends Model { protected $dates = [ "sent_at", ]; } I have the following function that updates the Invoice : InvoicesController.php : public function postPayInvoice(Request $request, $invoiceId){ $user = $this->apiResponse->user; $invoiceItemIds = $request->input("invoice_item_ids"); $invoice = Invoice::with(["invoiceItems"