Tray2

Oracle Developer (PL/SQL, Forms & Apex) at Scania CV AB

Member Since 6 Years Ago

Solna

Experience Points
464,900
Total
Experience

0 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
1735
Lessons
Completed
Best Reply Awards
419
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • Community Pillar

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

Level 50
464,900 XP
Jun
11
2 days ago
Activity icon

Awarded Best Reply on Call To A Member Function WithInput() On String

Are you using a really old guide or a really old version of Laravel?

If not read the latest docks or the one that fits your version

https://laravel.com/docs/8.x/validation

Jun
10
3 days ago
Activity icon

Replied to How To Make Foreach For All Records Of Model

What happens if you do this instead

$reportsArray = [];
$reports = Report::all();

foreach ($reports as $report ) {
    $one_report = $report;
    $reportsArray[] =  new CreateTurnover($one_report))();
}

return reportsArray;
Jun
09
4 days ago
Activity icon

Replied to Call To A Member Function WithInput() On String

Are you using a really old guide or a really old version of Laravel?

If not read the latest docks or the one that fits your version

https://laravel.com/docs/8.x/validation

Jun
08
5 days ago
Activity icon

Awarded Best Reply on Anonymous Posting

I would just store the user id as normally and add a field for display username then in the query check if it's the author of the post/comment and then determine whether to pass pass username or not.

Jun
07
6 days ago
Activity icon

Replied to Getting RAW JSON From PostGreSQL.

If your query takes 38 seconds then you are most likely missing some indexes. I highly suggest you add those indexes instead of storing data as json.

Storing data as json is not only adding complexity to your system that you don't need, it's also in my opinion a bad database design and not to mention a bad practice.

Jun
05
1 week ago
Activity icon

Replied to Anonymous Posting

I would just store the user id as normally and add a field for display username then in the query check if it's the author of the post/comment and then determine whether to pass pass username or not.

Jun
04
1 week ago
Activity icon

Replied to Check Between Many Records In The Same Table

What is the desired result?

Activity icon

Replied to Laravel Job For Checking A Database Table Column

Just write the sql statement in a migration.

Similar to this but with code for a trigger.

  public function up()
    {
            DB::statement(
                "CREATE OR REPLACE VIEW record_views AS
            SELECT a.id artist_id,
                   a.name,
                   r.id record_id,
                   r.title,
                   r.released,
                   g.id genre_id,
                   g.genre,
                   f.id format_id,
                   f.format,
                   (SELECT ROUND(AVG(score), 1) FROM scores WHERE media_type_id = 4 AND item_id = r.id) rating
            FROM artists a,
                 records r,
                 genres g,
                 formats f
            WHERE r.artist_id = a.id
            AND r.genre_id = g.id
            AND   r.format_id = f.id"
            );
 }
Activity icon

Replied to Laravel Job For Checking A Database Table Column

I would use a trigger for that instead.

That way it will happen instantly and not needing to run a job.

https://www.mysqltutorial.org/create-the-first-trigger-in-mysql.aspx

Activity icon

Replied to Laravel Multiple Relation In A Same Table

To retrieve is you can do something like

You would of course have to adapt it for your table.

select * from
(select count(*) as Created from all_delivery_requests where status = 1),
(select count(*) as Released from all_delivery_requests where status = 2),
(select count(*) as Started from all_delivery_requests where status = 3),
(select count(*) as Executed from all_delivery_requests where status = 4),
(select count(*) as Canceled from all_delivery_requests where status = 5);
Jun
03
1 week ago
Activity icon

Awarded Best Reply on Paginate() Returns The Error :Undefined Column

This line says it all

SQLSTATE[42703]: Undefined column: 7 ERROR: column "competence_name" does not exist

You probably can't use an alias like that. refer to it with it's full name instead categories.competence

Activity icon

Replied to Paginate() Returns The Error :Undefined Column

This line says it all

SQLSTATE[42703]: Undefined column: 7 ERROR: column "competence_name" does not exist

You probably can't use an alias like that. refer to it with it's full name instead categories.competence

Activity icon

Replied to Paginate() Returns The Error :Undefined Column

This has nothing to do with paginate it is the aliased column competence_name that is the issue. Try removing it from the order by.

Activity icon

Replied to Error With Lost Connection With Internet On Laravel Php Website ERR_INTERNET_DISCONNECTED

This has nothing to do with Laravel.

It's most likely that when the computer (Server) goes to sleep aka hibernate it turns of the network adapter. I suggest checking the power save settings

Activity icon

Replied to Read-only File System Error On Artisan Storage:link Command

You need to chmod the storage directory.

Try this

sudo chmod -R 755 storage
Activity icon

Replied to How To Generate Migrations/seeds From Existing Db In Laravel 8?

So what you want is a seeder that fakes a certain number of records?

Activity icon

Awarded Best Reply on The Or (||) Is Working As And (&&) In My Function On The Form In Vue 3

Are these booleans

  • this.currentMedication.length
  • this.labInvestigation.length
  • this.prescribedMedication.length

If not, you need to compare them against something.

Jun
02
1 week ago
Activity icon

Replied to Application Goes Down On Large No Of Request

I highly suggest setting up a linux host instead.

Activity icon

Replied to Application Goes Down On Large No Of Request

Sounds to me that you might have a bit of overhead in your application.

300 simultanious requests isn't that much so the spec probably is enough.

Are you using ajax for the requests or is it a full page reload for every question?

Are you using nginx or Apache2?

Are you running linux on the server?

Virtual machine or dedicated server?

Activity icon

Replied to How To Reformat Code On Commit?

@automica True but it's still possible.

I would adapt to the standard used by the company instead since it will save a lot of hassle even if I don't necessarily agree the the standard used.

Activity icon

Replied to Slow Response

I suggest you remove the ->get() and replace it with ->toSql() that way you will det the query. Copy the query into a database IDE like Tableplus and prefix it with EXPLAIN.

You will get a list of actions and you should look for full table scans and cartesian products. The first means that you are most likely missing an index on that field. Add the index and run the explain query again.

Cartesian fproduct means that you most likely have a bad join between tables. You can try adding extra conditions to the join.

You can check this link for some more info regarding optimizing SQL

https://sitepoint.com/using-explain-to-write-better-mysql-queries/

This is the part that takes time. Using likes isn't the best option since it will most likely cause a full table scan which is bad when you have 3 million rows.

 ->where("so","not like", "RD/%")
  ->where("so","not like", "%issue")
  ->where("so","not like", "ST%")
  ->where("so", "not like", "d%")
  ->whereNotIn("so", ['245444-16','245444-16A','246002-1','250009-2'])
  ->where('customer_id', '=', $countrycode)
  ->whereDate('input_date', '>', '2020-11-01')
Jun
01
1 week ago
Activity icon

Replied to Website Is Slowed By 40000ms Every Time

Have you added any throttling?

Have you asked the provider to check the steal on the server? sar

Activity icon

Replied to Website Is Slowed By 40000ms Every Time

Other than the mentioned possibility of a ddos attack it might be that your site recently reached a threshold in your database and now your queries runs slow because the received bad execution plans.

I suggest you check your queries and make sure that your indexes are correct. If you are storing large chunks of data in clobs or blobs it might be a good idea to reorg those tables.

Activity icon

Replied to How Do You Outsource Website Designers?

The cheapest way is to buy tailwindui, they have a ton of prebuilt components

https://tailwindui.com/

Activity icon

Replied to Database Seeding

You can use regular php in your seeder so you can manipulate the string as you please.

I would add a counter that keeps track of the current number then increase for every itteration.

Something like

$prefix = 'INV100-21-';
$counter = 1;

foreach ($items as $item) {
	$sn = $prefix . str_pad($counter, 6, "0", STR_PAD_LEFT);
	
	//Do your insert here

	$counter++;
}
May
31
1 week ago
Activity icon

Replied to Laravel Blade Only Displaying 10 Of 16 Records

I suggest you start from the begining

@foreach($candidates as $candidate)
 {{ $candidate->id }}
@endforeach

Then add the rest of the fields one by one until it breaks, If it doesn't break then add the html necessary.

Try to avoid using code like this in your views

 @php
    $data = "";
     try {
         $date = explode(" ",$vacancy->created_at)[0];
      } catch (Exception $e){

       }
 @endphp

If you need to modify the data you should use an accessor instead https://laravel.com/docs/8.x/eloquent-mutators#defining-an-accessor

Activity icon

Replied to The Or (||) Is Working As And (&&) In My Function On The Form In Vue 3

Try using a regular comparsion of the values

if (this.currentMedication.length < 1 || this.labInvestigation.length < 1 || this.prescribedMedication.length < 1)
Activity icon

Replied to Get All Console Commands

Are we talking about how long php artisan make:controller SomeController takes or is it jobs that you try to meassure?

If so I suggest you use Telescope for that.

https://laravel.com/docs/8.x/telescope

May
30
2 weeks ago
Activity icon

Replied to Getting Error Server Error 500 In Updating In Aws Server

Have you taken a look in the storage/log directory?

Activity icon

Replied to The Or (||) Is Working As And (&&) In My Function On The Form In Vue 3

Are these booleans

  • this.currentMedication.length
  • this.labInvestigation.length
  • this.prescribedMedication.length

If not, you need to compare them against something.

Activity icon

Replied to Load Data From Non Related Table.

There are two ways of doing this

  • Add driver_id to the trips table and make it nullable
  • Make a pivot table driver_trip and join them that way

I'm a bit allergic to making foreign keys nullable so I would probably go with the second option.

Activity icon

Replied to Laravel Auto Discovery Not Working

Sounds to me like some kind of permission issue.

Activity icon

Replied to How To Get The Best Performance Out Of Laravel

What do you mean by 3D rendering?

If you talk about canvas and javascript then all that is done on the client side.

The Laravel footprint is usually pretty small to begin with. If your queries are running fast with the proper indexes and you don't do anything in php that you can do in the database you should be good.

NginX is a very good lightweight webserver and with the right setting should run your site without any issues and if it's client side heavy application it shouldn't be a problem at all.

Adding octane isn't the first thing I would add to my application unless we are talking tens of thousands simultanious users.

Laravel Octane supercharges your application's performance by serving your application using high-powered application servers, including Swoole and RoadRunner. Octane boots your application once, keeps it in memory, and then feeds it requests at supersonic speeds.

May
28
2 weeks ago
Activity icon

Replied to Post Request Stops Working

Telescope is great but the debugbar is a bit slimmer

Activity icon

Replied to Controller Not Exist Error

Have you checked that the file exists and that it has the proper namespace?

Activity icon

Replied to Check If The Db Table Is Empty

Why are you using one db per user?

If it's for multi tenancy check out this

https://laracasts.com/series/multitenancy-in-practice

Other than that you can do

if (Auth::user()->db_name == null)
Activity icon

Replied to Get All Console Commands

The question is still why would you need to have a list of artisan commands in your app?

Activity icon

Replied to Get All Console Commands

Why would you want to do that? To me it sounds dangerous since you can do a lot of stuff with it,

May
27
2 weeks ago
Activity icon

Replied to Need Help Cleaning Up Complicated Query

Show us a sample of your database and the desired result to make this more understandable.

Activity icon

Replied to Post Request Stops Working

Install the laravel debugbar and it will tell you what takes time.

https://github.com/barryvdh/laravel-debugbar

May
26
2 weeks ago
Activity icon

Replied to Database Gets Empty - With Php Artisan Test

The database should normally be empty when you start the test and be empty when the test finishes.

Are you using DatabaseMigrations in your test class?

Activity icon

Replied to Why Laravel Empty Api Endpoints Taking 1.5 Seconds

What do you do in the endpoint?

Without knowing anything about what you are trying to do, it's impossible to guess.

However usually if something takes time it's most likely the query of the database that are missing some indexes.

Activity icon

Replied to Javascript

First of, why are you using JavaScript to add those fields?

Second check the docs https://laravel.com/docs/8.x/billing

Activity icon

Replied to StoreAs

Probably not Laravel native but what does this have to do with storeAs??

The person who wrote the original code probably didn't know about Str::slug.