Skip to content

Tag: laravel-5.6

upload image to server modifying name

I am building a form with laravel 5.6 and where I save a name and a user photo, but i need the photo to be stored with the username. I show the code of my store I can get the username with $request->nombre; but I don’t know how to assign that name to the photo Answer There is a ->storeAs()

Spatie/Newsletter: MailChimp Invalid MailChimp API key “ supplied in Laravel 5.6

Good morning all of you, I’m currently working on using spatie/newsletter in my laravel 5.6 Blog to work with MailChimp to create a newsletter where users can subscribe. When I try to subscribe, I get this response: My Controller Env File newsletter.php (after running php artisan vendor:publish -provider=”SpatieNewsletterNewsletterServiceProvider”) I have also added the SpatieNewsletterNewsletterServiceProvider::class, into the app/config providers aswell as

whereJsonContains Laravel 5.6 not working?

The eloquent query above seems to only work when there is a single item in the ‘players’ json array. The data stored in the database looks as follows: [1] vs [“1″,”2”] Is there a reason the whereJsonContains is only working when it sees [1] in the db but not when it sees [“1″,”2”] ? I am pretty new to Laravel

Laravel 5.6 time ago in views

Is it possible to echo the Time Ago in my View ( pages.dashboard.dashboard ) Something Like, Expecting output like, Answer First, try an eloquent model. $users = AppUser::orderBy(‘created_at’,’desc’)->limit(5)->get(); in view @foreach($users as $user) {{$user->created_at->diffForHumans()}} @endforeach In Terms for your case $users = DB::table(‘users’)->orderBy(‘created_at’,’desc’)->limit(5)->get(); @foreach($users as $user) {{ CarbonCarbon::parse($user->created_at)->diffForHumans()}} @endforeach Explanation The eloquent model automatically get casts to Carbon instance and

Laravel 5.6 – User not getting authenticated

I have looked for days, but my user never gets authenticated when using the auth middleware. We don’t use the standard laravel way, but using the standard auth middleware to block access to a route group. (in this example the dashboards) The data is correct as it doesnt give any error message, but the user itself never gets authenticated. I’ve