skip to Main Content

Track the last activity in laravel

In laravel auth middleware i create session variable and store the the last entering time like class Authenticate extends Middleware { public function handle($request, Closure $next, ...$guards) { if (auth()->check()) { session()->put('activity_time', now()->toDateTimeString()); } return parent::handle($request, $next, ...$guards); } protected…

VIEW QUESTION

Create a sitemap for laravel like rankmath

I want to create a sitemap for laravel, structure same like wordpress's rankmath sitemap... i am adding a route like this - **Try 1** Route::get("/(*).xml", "SomeController@serve"); - **Try 2** Route::get('{slug}.xml', 'SomeController@serve'); But it's not working... Can anyone provide better solution?…

VIEW QUESTION

Laravel local scope with hasMany relation

I have a Laravel model Product and Vouchers defined as follows: class Product extends Model { public function vouchers(): HasMany { return $this->hasMany(Voucher::class); } } and class Voucher extends Model { public function product(): BelongsTo { return $this->belongsTo(Product::class); } }…

VIEW QUESTION

Modify JSON output in Laravel

I want to remove some elements from my JSON output. My Output is: [ { "current_page": 1, "data": [ { "_id": "6580f69587f0f77a14091c22", "email": "[email protected]", "first_name": "Janz", "last_name": "Boy", "password": "1995", } ], "first_page_url": "http://localhost:8000/api/customer?page=1" } ] I want a simple…

VIEW QUESTION

Empty request parameters in Laravel 10

I have a strange problem with my project in Laravel 10. My $request comes empty in my controller. Controller public function postSettings(Request $request){ $user = $request->user(); $request = $request->validate([ 'scroll_lock' => 'boolean', 'test_mode' => 'boolean', ]); $settings = Settings::find($user->id) ?…

VIEW QUESTION

Laravel Class Intervention Image not found

I'm new to Laravel, I use Intervention Image on laravel 10.39.0, but it is getting error, Class "InterventionImageFacadesImage" not found This is the code. This is the code. <?php namespace AppHttpControllers; use IlluminateHttpRequest; use InterventionImageFacadesImage; class HomeController extends Controller {…

VIEW QUESTION
Back To Top
Search