jamiesefton

jamiesefton

Member Since 2 Years Ago

Experience Points 630
Experience Level 1

4,370 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 0
Lessons
Completed
Best Reply Awards 1
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

21 Dec
2 years ago

jamiesefton left a reply on How To Show The Number Of Rows By Taking The Count From User

Yeah looking at the above code snippet that should work? Does it not currently?

What do you get returned from that?

jamiesefton left a reply on Calculate Field Value Before Save

Yes using an observer is the correct way to bind a process to before a save or update.

You can then do extra processing to rename the data and store it accordingly. Just register the observer in your service provider to watch the specific model that is storing the image field

https://laravel.com/docs/5.3/eloquent#observers

jamiesefton left a reply on Laravel Token

Try adding this in the head tag of your views

<meta name="csrf-token" content="{{ csrf_token() }}">

jamiesefton left a reply on View Sharing , Laravel 5.3

You can call view as a function rather than a class, maybe that might help?

view()->share('nots', Auth::user()->notifications);

Another way to do this is with composers and views. So you register a method for all composer views and add an extra data item to be return in the with. The main reason is with Service Providers is getting the current Auth user can sometimes not work, especially if you are using a different Auth provider.

Something like this might work:

view()->composer('*', function ($view) {
    if(auth()->check()){
        $view->with('isAdmin', auth()->user()->notifications);
    }    
});

jamiesefton left a reply on Multiple Companies In One Database Or One Company Per Database?

I'd agree with most that one database is the best way. Then have a companies table and a foreign key in all the other tables to give ownership over the rest of the data stored in the database.

Then the best way to ensure a company gets the right data is creating a company middleware and wrap it around all the routes. Upon login it would set the current session company_id then you can validate against all requests to resources to ensure they have permission to access it.

You could also set in the parent controller a $company that is set through this method and passed around, so you have $company->{resource} ensuring all the returned data is linked to the company if you use Eloquent relationships between everything

jamiesefton left a reply on How To Show The Number Of Rows By Taking The Count From User

That above snippet would bring back the number of rows specified by $count.

So if $count = 5 then the first 5 rows should be returned.

Is that not what you want to do?

20 Dec
2 years ago

jamiesefton left a reply on Informal Poll: Routes File

+1 for keeping it and include by default

jamiesefton left a reply on How To Get Data From DB To My Frontend View

You should have a model for each of the different data sets that you want to load in. If you don't use:

php artisan make:model <MODEL_NAME>

Once you have the model you will need to add it using namespaces to the top of your controller file.

use App\<MODEL_NAME>

Once you have that you should be able to simple call the class and get data from it.

So for example if you have made your 'Post' model and add the namespace use above, you can simply pull in all posts with this:

$posts = Post::all();

To do more complex bits like get posts for a specific user you need to look into Eloquent relationships: https://laravel.com/docs/5.3/eloquent-relationships. If setup correctly you should be able to do something like this:

$user = User::find($id)->get();
$userPosts = $user->posts;