iqlas

iqlas

Member Since 2 Years Ago

Experience Points
8,650
Total
Experience

1,350 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
83
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 2
8,650 XP
13 Jan
8 months ago

iqlas left a reply on Append Query String To URL

@PATRICKSJ - @patricksj some of the pages require login & some don't. User locale would be a great add too. Thanks for suggestion.

The primary reason I wanted to generate urls with language defined in query string is to generate SEO friendly unique URL's for each language per page.

iqlas started a new conversation Append Query String To URL

I am working on multi lingual application in Laravel (5.7)

I have a middleware Locale which is applied for all the web routes group and it checks if the locale is set for application and sets if not. Here to make the URL unique for each language, I want to add query string ?lang=en or as required.

I used the following in Locale middleware

public function handle($request, Closure $next)
    {
        $lang=$request->query('lang') ? $request->query('lang') : 'en';
        app()->setLocale($lang);
        array_merge($request->query(), ['lang' => $lang]);
        return $next($request);
    }

The language is being set as required but the URL doesn't show the merged query string like /?lang=en

Can anyone suggest or guide me if there is a better way to implement this?

13 Dec
9 months ago

iqlas started a new conversation Push Data To Queue In Laravel

Laravel App checks redis database for data pushed by 3rd Party.

Laravel Scheduler runs artisan command php artisan check:redis every 10 mins.

I am expecting about 20k records to be checked every hour at peak times. Please also suggest me if my whole approach as a whole is flawed.

  • Scheduler runs check:redis command every 10 mins
  • check:redis command should dispatch job to be queued
  • Queue will later process jobs and create rows as required.

Below is handle() method from App\Console\Commands\CheckRedis

public function handle()
{
  while(Redis::llen('schema_queue')){
    dispatch(new CheckRedisJob($redis->rpop('schema_queue')))
  }
}

and this is App\Jobs\CheckRedisJob

public function handle()
{
    Stage::create([
        'model' => $this->entity->model,
        'payload' => json_encode($this->entity->payload)
    ]);
}

Now when I run the command, instead of queuing, it's directly creating what's in Stage::create()

Sidenote: Each job dispatched will have a Model name & payload and will be dynamically inserted to specified table by validating and/or checking as required which obviously takes time.(below is sample model/payload) That's where the whole idea of processing the Job Queue is.

{
  model : "Profession",
  payload: {
              id: '......',
              name: '........',
              contract_type: '........',
              employment_type: '........',
              department: '........'
              .... and like 20 other fields...

           }
}
27 Nov
9 months ago

iqlas left a reply on Eloquent Relations?

It depends on your requirement. If you want each review to be of a single type, you can go for One to Many relationship. But if you're looking to tag each review with multiple review types, you can go for Many to Many

iqlas left a reply on Transform A PHP Array On A HTML Table

Could you provide sample array & output you're expecting. That way anyone can easily understand your requirement instead of going thru lines of code

25 Nov
9 months ago

iqlas left a reply on User Permission For Specific Resource

One of the simple solutions if I got your question right i.e., there's a many to many relationship and one of the users shall be leader of a particular project.

What I might do is use leader_id column on Projects table and a method on Project Model passing in the user something like isUserLeader(User $user) and then necessary authorization as required.

If multiple users can be leaders for project, then among other solutions, simplest would be to have array/json for leader_id.

iqlas left a reply on User Permission For Specific Resource

Please check Ep 26 & 27 on Laracasts in the Series Laravel 5.7 from scratch. It may answer.

https://laracasts.com/series/laravel-from-scratch-2018

iqlas started a new conversation Periodic Check For Posted Data On Cache Db

I am working on a Laravel App that should periodically check if the data is posted(by third party application) to redis database. If the data is present, further processing is done.

Should I create events/listeners/jobs and trigger them from Laravel Task Scheduler? Please let me know the best practice.

31 Oct
1 year ago

iqlas started a new conversation Best Practice: Middleware In Routes Or In Each Controller

I see no difference using Middleware in the routes/route groups or in each individual controller. Except for very few routes (like logout for eg), I would have to use Auth middleware for everything.

So I am wondering if it is okay if i just use them in routes/web.php on a group?

Route::middleware('auth')->group(function(){
    Route::resource('foo', 'FooController');
    Route::resource('bar', 'BarController')->except(['destroy']);
   ..
   ..
});

Am I missing any security with this? What is community best practice for middleware.

07 May
2 years ago

iqlas started a new conversation Access The Files Uploaded To Storage\app\subfolder\filename.ext

I am trying to store uploaded files to storage\app folder with subfolder created for each upload. Below is the code for uploading files.

$client=Client::find($client_id);
        if($request->hasFile('attachment')){
            $attachment=$request->attachment;
            $path = $attachment->storeAs("clients/".$client->code, \Carbon\Carbon::now()->timestamp.'.'.$attachment->extension());
        }else{
            $path='';
        }

Upload is successful, and the file is getting stored in storage\app\clients\client_code\filename.ext. I am trying to access the uploaded file by

<a href="{{ Storage::url($cr->attachment) }}"><i class="fa fa-download"></i></a>

When i click on link, it throws 404 Error.

Can someone let me know how to access the uploaded files.