Tray2

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

Member Since 6 Years Ago

Solna

Experience Points
443,980
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
1656
Lessons
Completed
Best Reply Awards
403
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
443,980 XP
Apr
13
8 hours ago
Activity icon

Replied to How To Load View Part By Part In Laravel?

All filtering and sorting should be done in the database. It is faster and better at it than any php code you will ever write.

Apr
12
1 day ago
Activity icon

Replied to Test Fails When Running All Test

Where do you add the user to the database? If there are no users in the database which it isn't when you refresh the database it will fail the login.

Activity icon

Replied to Sql Errors On Laravel Docker

I can recommend this course for that

https://laraveldocker.com/

Apr
10
3 days ago
Activity icon

Awarded Best Reply on Inserting Data Into A Table

You can do this.

$model = new Model();
$model->field = $request->field
$model->field2 = $value;
$model->save();

Or this

$data = $request->validate($rules);
$data['another_field'] = $valiue;
Model::create($data);
Activity icon

Replied to Inserting Data Into A Table

You can do this.

$model = new Model();
$model->field = $request->field
$model->field2 = $value;
$model->save();

Or this

$data = $request->validate($rules);
$data['another_field'] = $valiue;
Model::create($data);
Activity icon

Awarded Best Reply on What Technology To Use For A New Project?

I would most likely build everything in Laravel and use the artisan console commands for doing the console stuff

Apr
09
4 days ago
Activity icon

Replied to How Can I Install 5.8 Laravel?

Ok, that is a valid reason, You probably should update those videos ;)

Activity icon

Replied to How Can I Install 5.8 Laravel?

Why use 5.8 for a new project?

Activity icon

Replied to What Technology To Use For A New Project?

I would most likely build everything in Laravel and use the artisan console commands for doing the console stuff

Activity icon

Awarded Best Reply on Laravel And DDOS Attacks

You can add the throttle middleware to your routes

https://laravel.com/docs/8.x/routing#rate-limiting

Activity icon

Replied to Laravel Slow Query For 30000 Db Rows

@binggle that might seem like a good option but that isn't always the case.

With the wrong indexes you might make it harder for the parser to generate the best execution plan.

Apr
08
5 days ago
Activity icon

Replied to Writing Laravel Tests After Developing The Entire App

That is up to you but the thought behind TDD is not to write any code until you have a failing test.

Activity icon

Awarded Best Reply on Get A Model By `model_type` & `model_id` (polymorphic Relation)

Just use a simple where

->where([ 
		['model_type',  '=',  'App\Model\Post' ],
		[ 'model_id', '=', 1]
])
Activity icon

Replied to Remove Array From Json Column

Why are you using a json column to begin with?

They will only make your life harder.

Create a proper database model instead it will be much faster and it won't give you the headache of doing crud in a json field..

Activity icon

Replied to File Upload

What happens if you change this line in your validations?

 'files.*' => ['required']

to

 'file' => ['required']
Activity icon

Replied to File Upload

Have you set the enctype in your view?

enctype="multipart/form-data"
Activity icon

Awarded Best Reply on Laravel Slow Query For 30000 Db Rows

Try adding an index to the created_at field and you should see an performance increase.

$table->index('created_at');

https://laravel.com/docs/8.x/migrations#available-index-types

Activity icon

Replied to Get A Model By `model_type` & `model_id` (polymorphic Relation)

Just use a simple where

->where([ 
		['model_type',  '=',  'App\Model\Post' ],
		[ 'model_id', '=', 1]
])
Activity icon

Replied to Remove Duplicated Data Based On Quintity

So you only want records that has an aquantity that is bigger than bquentity?

Then use a where

->where('aquantity', '>', 'bquantity')
Activity icon

Replied to Designing Database, Are Pivot Tables A Good Or Bad Thing?

Pivot tables are great but not for what you are trying to achieve.

Create one table called user_properties or similar then you have three fields

  • user_id
  • property
  • value

Your records would look something like this

1 |   language  | English
1  | language | Danish
1   |hobby | Paragliding 
Activity icon

Replied to Notifications At Scale > 1 Million Users

You can also use chunking so that you send maybe 4000 every itteration.

Activity icon

Replied to Laravel And DDOS Attacks

You can add the throttle middleware to your routes

https://laravel.com/docs/8.x/routing#rate-limiting

Activity icon

Replied to Failed Asserting That Two Strings Are Equal In File GravatarTest.php.

You pass it an email and expect it to be null?

Activity icon

Replied to Loop

Does that class exist? Have you imported it properly? Does it have the correct namespace?

Activity icon

Replied to Redirect After Failed Login In Laravel 8?

I suggest you use laravel breeze or laravel jetstream instead of building your own login,

The solutions for Laravel 5 will most likely work in Laravel 8 as well

Apr
07
6 days ago
Activity icon

Replied to Laravel Slow Query For 30000 Db Rows

Try adding an index to the created_at field and you should see an performance increase.

$table->index('created_at');

https://laravel.com/docs/8.x/migrations#available-index-types

Activity icon

Replied to Composite Primary Key With UpdateOrCreate

Why can't you just use the id?

Check out this post

https://blog.maqe.com/solved-eloquent-doesnt-support-composite-primary-keys-62b740120f

Eleoquent doesn't support it but it seems that the query builder does so I suggest you use it.

Activity icon

Replied to Fresh Laravel Install Throws Exception

Do you have the correct permissions and owner on the files and directories?

If you haven't already I suggest you install a proper lamp or lemp instead of using serve.

https://www.howtoforge.com/tutorial/install-laravel-on-ubuntu-for-apache/

https://www.howtoforge.com/tutorial/ubuntu-laravel-php-nginx/

Or even using docker

https://www.howtoforge.com/dockerizing-laravel-with-nginx-mysql-and-docker-compose/

Activity icon

Replied to Loop

What doesn't work?

What error messages do you get? What do you expect to see?

What happens if you do

foreach($model as $transaction => $value) {
	$value::selectRaw() //and so on
}
Activity icon

Replied to How Can I Use Eloquent Resource For My Package

You can create a models directory in your tests directory and add it to autoload dev in your composer.json file

  "autoload-dev": {
      "psr-4": {
        "App\Models\": "tests/laravel/Models"
      }
    },

Then you can use eloquent in your code,

Activity icon

Awarded Best Reply on PDOException: SQLSTATE[HY000] [1045] Access Denied For User 'forge'@'localhost' (using Password: NO)

You probably use database migrations in your tests. Then the migrations is rolled back.

Activity icon

Replied to Fresh Laravel Install Throws Exception

What OS are you running?

Activity icon

Replied to Search Keyword In Table List

Are you sure you have the word sulaimani in one of those fields in the database?

Apr
06
1 week ago
Activity icon

Replied to No Permissions To Folders Created By Www-data

Never use 777 as a permission. With that permission anyone can crash your site by running a simple rm -rf ./

Activity icon

Replied to No Permissions To Folders Created By Www-data

Why do you create a OS user when creating an application user?

One option is to add the created user to the www-data group however this gives the user pretty much full access to everything in your web root which is really bad.

I say rethink your strategy here and give some really compelling reasons to do it that way.

Activity icon

Replied to Thoughts On Typescript?

It's basically just typed javascript that needs to be compiled into regular javascript. It has its benefits but unless you want javascript typed it's really not that necessary imho.

Activity icon

Replied to PDOException: SQLSTATE[HY000] [1045] Access Denied For User 'forge'@'localhost' (using Password: NO)

You probably use database migrations in your tests. Then the migrations is rolled back.

Activity icon

Replied to PDOException: SQLSTATE[HY000] [1045] Access Denied For User 'forge'@'localhost' (using Password: NO)

Are you using Orchestra/Testbench?

If so check your TestCase.php file and make sure you have the correct config there.

It might look something like this

  protected function getEnvironmentSetUp($app): void
  {
      $app['config']->set('database.default', 'mysql');
      $app['config']->set('database.connections.mysql', [
          'driver'   => 'mysql',
          'database' => 'mediabase',
          'prefix'   => '',
          'username' => 'root',
          'host' => '127.0.0.1'
      ]);
  }
Activity icon

Awarded Best Reply on How To Stack Multiple Validation Rules

You could probably get away with using exclude_if on the rules after,

https://laravel.com/docs/8.x/validation#skipping-validation-when-fields-have-certain-values

Activity icon

Replied to PDOException: SQLSTATE[HY000] [1045] Access Denied For User 'forge'@'localhost' (using Password: NO)

Are you running phpunit from the project root?

Do you have SQLite installed?

Have you defined a connection in any of your models?

Activity icon

Awarded Best Reply on Sort Data, Based On A Specific Column

Of course not, You need to order it when you fetch it from the database not after it's already fetched,

Activity icon

Replied to Sort Data, Based On A Specific Column

Of course not, You need to order it when you fetch it from the database not after it's already fetched,