php artisan make:auth in laravel 5 have a bug - laravel-5

In laravel 5.2 after I use php artisan make:auth -> it download some package fine and I also can open the page like this:
but after I click the link for login, it always error like this:

at kernal.php [ app/Http/Kernal.php ]
Move StartSession::class and ShareErrorsFromSession::class to protected
Eg:
protected $middleware = [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
];

Related

Laravel with PhpStorm, Method findOrFail not found

I am using PhpStorm v2021.2, have Laravel plugin (by Daniel Espendiller v0.15.4) installed and enabled, Laravel Query (by Ernestas Kvedaras v2.0.6) and I am also using barryvdh/laravel-ide-helper v2.10.0. I updated composer.json with this bit of code:
"scripts": {
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"#php artisan ide-helper:generate",
"#php artisan ide-helper:meta"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan ide-helper:generate",
"#php artisan ide-helper:meta",
"#php artisan package:discover --ansi"
],
so it regenerates all meta and helpers and it successfully creates files .phpstorm.meta.php and _ide_helper.php.
All my models do extend Illuminate\Database\Eloquent\Model. Not directly, I also wrote a BaseModel with some of default properties, so it looks like this:
BaseModel.php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
//
}
Client.php
namespace App\Modules\Clients\Entities;
use App\Models\BaseModel;
...
class Client extends BaseModel
{
//
}
But I am still seeing Method 'findOrFail' not found in \App\Modules\Clients\Entities\Client. What else can I do to make this notice go away?

Reset Password sending me localhost url laravel

When i click on Reset Password and fill the email and submit it.. then I am getting email for reset but URL is localhost my project is on production server.
In my config\app.php:
'url' => env('DB_HOST'),
and
I also try this : 'url' => env('APP_URL', 'http://yourtradelog.com'),
this is my env. file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=**7
MAIL_USERNAME=apikey
MAIL_PASSWORD=SG.E*****hSbq1IAhFC1tPQg.uFah8Jwtm6GY7lh10wGpA_CPU01ySmAC26HFylz_BFI
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME="Your Trade Log"
MAIL_FROM_ADDRESS=****#yourtradelog.com
This is my reset...:
public function toMail($notifiable)
{
if (static::$toMailCallback) {
return call_user_func(static::$toMailCallback, $notifiable, $this->token);
}
return (new MailMessage)
->subject(Lang::getFromJson('Reset Password Notification from YourTradeLog.com'))
->line(Lang::getFromJson('You are receiving this email because we received a password reset request for your account.'))
->action(Lang::getFromJson('Reset Password'), url(config('app.url').route('password.reset', $this->token, false)))
->line(Lang::getFromJson('If you did not request a password reset, no further action is required.'));
}
Run the following commands
php artisan clear-compiled
php artisan cache:clear
php artisan route:clear
php artisan view:clear
php artisan config:clear
Also in your .env
set the APP_URL=http://yourtradelog.com

php artisan vendor:publish mervick/emojionearea

In installation no describe process publishing this package.
But I would like to setup it.
Laravel 5.6
composer require mervick/emojionearea ^3.0.0
and I need to copy from folder /vendor to /public/vendor using
php artisan vendor:publish
I created file /vendor/mervick/emojioneareaServiceProvider.php
and added lines:
public function boot()
{
$this->publishes(
[
__DIR__ . '/dist' =>
public_path('vendor/mervick/emojionearea/dist'),
],
'emojionearea'
);
}
also, I added lines to /config/app.php
//ServiceProviders
Mervick\EmojioneArea\EmojioneAreaServiceProvider::class,
//Aliases
'EmojioneArea'=> Mervick\EmojioneArea\EmojioneAreaServiceProvider::class,
and run command :
php artisan vendor:publish
also, I used the command:
php artisan vendor:publish --provider="Mervick\EmojioneArea\EmojioneAreaServiceProvider"
Any help.Thanks.
Please follow below steps i have tried moved files to public/vendor folder by updating below steps. Its works fine.
Service provider file.
<?php
namespace mervick\emojionearea;
use Illuminate\Support\ServiceProvider;
class EmojioneAreaServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* #return void
*/
public function boot()
{
$this->publishes([
__DIR__.'/../dist' => base_path('public/vendor/dist'),
]);
}
}
In your root composer.json file add your vendor for identify the service provider.
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/",
"Mervick\\EmojioneArea\\": "vendor/mervick/emojionearea/src"
}
}
Like you said don't forgot to add the service provider in config/app.php
Mervick\EmojioneArea\EmojioneAreaServiceProvider::class,
If everything works fine for you. Please make it as correct answer.:-)

Routing exclusion laravel 5.4

I have a problem here that needs your help. how to send the form without {{csrf_field()}} to laravel 5.4.
Added his file to the file VerifyCsrfToken.php in the field $except = []; but it does not work. Help please.
Add you from route in VerifyCsrfToken Middleware file in protected except array
like this
protected $except = [
'stripe/*',
];
further more info check lavarel csrf
hope it will help you.

error while trying to run artisan command with Artisan Facade

here's the code
Route::get('run-cmd', function() {
Artisan::call('make:controller HelloController');
});
and I wonder I'm getting this error...
InvalidArgumentException in Application.php line 549:
Command "make:controller HelloController" is not defined.
Did you mean one of these?
make:migration
make:controller
make:middleware
make:request
make:provider
make:console
make:event
make:model
make:command
what's wrong?
Replace
Artisan::call('make:controller HelloController');
with
Artisan::call('make:controller', [ 'name' => 'HelloController' ]);

Resources