laravel-5.4

Allow login using username or email in Laravel 5.4

China☆狼群 提交于 2019-12-03 00:06:15
Now I've followed the Laravel documentation on how to allow usernames during authentication, but it takes away the ability to use the email. I want to allow users to use their username or email to login. How do I go about this? I've added this code to the LoginController as per Laravel's Documentation and it only allows username for login. I want it to accept username or email for login. public function username () { return 'username'; } Follow instructions from this link: https://laravel.com/docs/5.4/authentication#authenticating-users Then you can check for the user input like this $username

The “--queued” option does not exist in Laravel 5.4

狂风中的少年 提交于 2019-12-02 23:48:51
I'm going to create Queue job for mailing. once I hit the artisan command in command prompt php artisan make:job SendSMSMessages --queued I got the issue as is follow. The "--queued" option does not exist. I'm using Laravel 5.4 Please anyone can help me for the same. I have searched a lot but didn't found any good solutions. Thanks The option --queued, was introduced in Laravel 5.0, and remained an option until version Laravel 5.1 https://laravel.com/docs/5.1/queues#writing-job-classes Since Laravel version 5.2 onwards, --queued was deperecated as by default all newly created jobs are "queued"

PHP Fatal error: Interface 'JsonSerializable' not found - My Php Version is 7.0.17 [closed]

瘦欲@ 提交于 2019-12-02 17:23:31
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I Developed One Laravel Project. In local System Its working Fine. When i move the Project to the Server. Its Return Following Error. PHP Fatal error: Interface 'JsonSerializable' not found in /home/vendor/laravel/framework/src/Illuminate/Support/Collection.php on line 18 My PHP Version is 7.0.17. How to Fix

Laravel to get db values from session id

风流意气都作罢 提交于 2019-12-02 17:16:43
问题 I am trying to create a session and retrieve it and get db values using the session id (i.e) While on click edit i like to store the data-id in session and from session id i like to retrieve the db values using Eloquent so far i stored and retrieve the session the only problem i don't know to get db from that session id here is my following code My ajax call : $(document).ready(function(){ $('.editaction').click(function(){ var editaction=($(this).attr("data-id")); console.log(editaction); $

Laravel to get db values from session id

霸气de小男生 提交于 2019-12-02 09:26:31
I am trying to create a session and retrieve it and get db values using the session id (i.e) While on click edit i like to store the data-id in session and from session id i like to retrieve the db values using Eloquent so far i stored and retrieve the session the only problem i don't know to get db from that session id here is my following code My ajax call : $(document).ready(function(){ $('.editaction').click(function(){ var editaction=($(this).attr("data-id")); console.log(editaction); $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); $.ajax({ type

PHP Fatal error: Interface 'JsonSerializable' not found - My Php Version is 7.0.17 [closed]

孤人 提交于 2019-12-02 08:43:23
I Developed One Laravel Project. In local System Its working Fine. When i move the Project to the Server. Its Return Following Error. PHP Fatal error: Interface 'JsonSerializable' not found in /home/vendor/laravel/framework/src/Illuminate/Support/Collection.php on line 18 My PHP Version is 7.0.17. How to Fix this Issue. Collection.php use Countable; use Exception; use ArrayAccess; use Traversable; use ArrayIterator; use CachingIterator; use JsonSerializable; use IteratorAggregate; use InvalidArgumentException; use Illuminate\Support\Traits\Macroable; use Illuminate\Contracts\Support\Jsonable;

How to access the contents of this collection in laravel/php

孤街醉人 提交于 2019-12-02 08:38:46
I am new to Laravel and doing a project to build a mini-social network app.I have a post model that has a relationship with the user model. I have a Post page, where only the posts of the authenticated user and his/her friends will show. In my PostController, i queried for the friends of the authenticated user like so; $friends = Auth::user()->friends(); Where the friends() object has earlier been defined in my friendable trait. That works well as shown in the screen shot. I tried to query for the posts whose user_id is that of the authenticated user or that of the friends, like so $posts =

CSRF on YAJRA datatable Laravel5.5 not working

一世执手 提交于 2019-12-02 07:50:58
I have this code where I needed to store in a variable so I display it in view, I've tried different approach of packing the "Form header" and using CSRF is not working $return = '<form method="post" action="/procurement/add-product"> '.{{ csrf_token() }}.' <input type="hidden" name= "product_id" value=".$row->id."> <input type="text" name="product_qty" class="form-control"> <button type="submit" class="btn btn-primary btn-block">Add Item</button> </form>'; return $return; Here is my route Route::post('/procurement/add-product','ProductController@addProcurementProduct'); Here is the JAvascript

Update data into table from dynamically created input field

心已入冬 提交于 2019-12-02 05:00:48
问题 I have 2 models Tour.php public function Itinerary() { return $this->hasMany('App\Itinerary', 'tour_id'); } and Itinerary.php public function tour() { return $this->belongsTo('App\Tour', 'tour_id'); } tours table: id|title|content itineraries table: id|tour_id|day|itinerary I have used vue js to create or add and remove input field for day and plan dynamically. And used the following code in tour.store method to insert into itineraries table: $count = count($request->input('day')); $temp_day

SQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Table

徘徊边缘 提交于 2019-12-02 03:30:44
问题 Here my migration table <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUserTable extends Migration { public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->integer('role_id')->unsigned(); $table->string('name'); $table->string('email',50)->unique(); $table->string('username'); $table->string('password'); $table->boolean('active'); $table-