laravel-5.6

How to override default forgot password mechanism of Laravel 5.6?

邮差的信 提交于 2019-12-24 23:30:17
问题 I wanted to login the user if his status field of users table was set to 1 otherwise not. So this problem was solved in this question which I had asked. How to override default login mechanism of Laravel 5.6? But now I am having another problem. When a user whose status is 0(not active) clicks the default forgot password link in login page and enters his email address and then clicks the reset link and fills the new password, he automatically gets logged in even though his status is 0(not

Cannot display related entities in one-to-many relationship

三世轮回 提交于 2019-12-24 19:14:38
问题 I have a one-to-many relationship in my code that I want to show on my view, but I get a NULL error. Below is the model with the defined relationship. public function products() { return $this->hasMany('App\Product', 'id', 'product_id'); } This is my controller method: $products = Invoice::with('products')->get(); return view('admin.invoices.show', compact('invoice', $invoice), compact('clients', $clients))->with(compact('products', $products)); This is my view, but it always displays no

How can I solve “Fatal error: Out of memory…” when I run command schedule laravel?

不打扰是莪最后的温柔 提交于 2019-12-24 18:30:46
问题 My command like this : <?php namespace App\Console\Commands; use Illuminate\Console\Command; use App\Models\ItemDetail; class ImportItemDetail extends Command { protected $signature = 'sync:item-detail'; protected $description = 'sync item detail'; public function __construct() { parent::__construct(); ini_set('max_execution_time', 0); ini_set('memory_limit', '-1'); } public function handle() { $path = storage_path('json/ItemDetail.json'); $json = json_decode(file_get_contents($path), true);

Save data from table rows in laravel

冷暖自知 提交于 2019-12-24 18:13:16
问题 I have multiple input fields with same name in a page when i try to save i throws an error.how should i save data from multiple table row data into database. the error Creating default object from empty value at here $varientaccesss->variant_id = $request->input('varient'), Controller public function storevarient_update(Request $request) { //return $request; $varientprice = new Price(); $varientprice->variant_id = $request->input('varient'); $varientprice->discount = $request->input('discount

Laravel 5.6 signed url won't work in APP_ENV=production

本秂侑毒 提交于 2019-12-24 17:57:38
问题 I've setup two routes Route::get('/bugreport', 'SomeController@create') ->middleware('signed') ->name('bugreport'); Route::get('/getlink', function() { return dd(\URL::signedRoute('bugreport', ['data' => 3])); }); When APP_ENV=local I can visit /getlink then hit the resulting url and have it show. When APP_ENV=production (the actual physical environment has not changed when changing the variable) this no longer works... stating invalid signature. Any suggestions? UPDATE: We do have... which

using Request::is() function with named Routes Laravel

大城市里の小女人 提交于 2019-12-24 17:15:34
问题 I was doing Request::is('/') which gave me true for example.com Now I am using named routes and for the name welcome Route::get('/', function () { return view('admin_panel.welcome'); })->name('welcome'); Request::is(route('welcome')) returns false What should I do. Note: I am using this for active states in navigation 回答1: You can use the routeIs method: Request::routeIs('welcome'); 回答2: I achieved this using Request::url() == route('welcome') which gave me true for example.com 来源: https:/

How can I display pagination in laravel?

你离开我真会死。 提交于 2019-12-24 16:00:07
问题 I use laravel 5.6 I try this documentation : https://laravel.com/docs/5.6/pagination My controller like this : public function index() { $products = $this->product->list(); dd($products); return view('admin.product.index',compact('products')); } My list function like this : public function scopeList($query) { return $query->orderBy('updated_at', 'desc')->paginate(20); } If I dd($products); , the result like this : On the view laravel, I add this : {{ $products->links() }} Then I check on the

laravel 5.6.4 authentication with “tymon/jwt-auth” is not working

独自空忆成欢 提交于 2019-12-24 14:30:26
问题 I was trying to install tymon/jwt-auth with laravel 5.6.4 using composer composer require tymon/jwt-auth but it is showing some error like this: Using version ^0.5.12 for tymon/jwt-auth ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - Conclusion: don't install barryvdh/laravel-cors v0.8.6 - Conclusion: don't install

Using Monolog WebProcessor with Laravel 5.6

房东的猫 提交于 2019-12-24 10:18:05
问题 I see that new logging stack/channels provides a way to tap or define handlers . However, I'm trying to get WebProcessor loaded and it doesn't seem to work. Should this be tapped? Or is there a different way to load this? This is specific to Laravel 5.6. Here is what I used in my older application that uses Laravel 5.2 ( bootstrap/app.php ): $app->configureMonologUsing(function (Monolog\Logger $monolog) { /* Include basic http props in logs */ $webProcessor = new Monolog\Processor

Implicit Route Model Binding

南笙酒味 提交于 2019-12-24 08:07:42
问题 Laravel's implicit route model binding isn't working. It is not looking up the record indicated by the identifier. I'm getting a brand new model object. Given this code: Route::get('users/{user}', function (App\User $user, $id) { $user2 = $user->find($id); return [ [get_class($user), $user->exists, $user], [get_class($user2), $user2->exists], ]; }); And this URL: /users/1 I get this output: [["App\\User",false,[]],["App\\User",true]] I'm on PHP 7.2 and Laravel 5.6. Additional Information I've