Drfraker

Drfraker

Bozeman, MT

Member Since 5 Years Ago

Experience Points 99,930
Experience
Level
Lessons Completed 1044
Lessons
Completed
Best Reply Awards 28
Best Answer
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.

05 Dec
4 days ago

Drfraker left a reply on Suggestions On Payment-processing

You'll want to use Stripe to process payments. https://stripe.com. Like @jlrdw said, they handle the actually transaction so you don't have to worry about storing (or even receiving) credit card information on your server. As for security, of course Laravel has sufficient security for an ecommerce site. It is running many many many many e commerce sites.

04 Dec
5 days ago

Drfraker left a reply on Incorrect Date Value

Use this package https://packagist.org/packages/cmixin/business-day + Illuminate\Suport\Carbon. No need to reinvent the wheel :) I've used it in a project doing something similar to what you're describing and it worked like a charm. Good luck!

Drfraker left a reply on Laravel Relative Paths In Urls

@jerauf You can make a new disk that points to any directory you want. See config/filesystems.php

 'disks' => [
    // This disk is there by default
        'local' => [
            'driver' => 'local',
            'root'   => storage_path().'/app',
        ],

    // add a new disk array, name it something else and change the path.
        'local-files' => [
          'driver' => 'local',
          'root' => '/path/to/files'
        ],

    // continue disks array ...

Then use Storage::disk('local-files')->files(); That will give you a list of all the files in the /path/to/files directory.

03 Dec
6 days ago

Drfraker left a reply on Laravel Relative Paths In Urls

What do you think is stored in /storage or /public? Maybe your question isn't clear.

02 Dec
1 week ago

Drfraker left a reply on Push Is Not A Function Vuejs

You don't have a push() method defined on Cart.vue but you are calling it in Main.vue. That's why you see that error.

Drfraker left a reply on Cache And Pagination

I second what @jlrdw said.

29 Nov
1 week ago

Drfraker left a reply on How Should I Go About This

@s3riouss If you like the solution I provided can you mark it as the best answer? Thanks.

28 Nov
1 week ago

Drfraker left a reply on Exception Handling In Laravel

public function store(Request $request)
   {
         // you always want to validate $request data
        // this validation will return the user back to the view and there will be errors in the error bag for you to check for in the view.
        $data = $request->validate([
            'deptstatus' => 'boolean'
        ]);
            
               $notification = Department::create([
            'deptstatus' => $data['deptstatus'] ? 'on' : 'disabled'
        ]);

        if(! $notification) {
            session()->flash('error', 'Something went wrong!');
        }
        
        session()->flash('message', 'Your department was saved');
               
        return view('departments.index');
   }
27 Nov
1 week ago

Drfraker left a reply on How Should I Go About This

You can make a view for selecting locations to manage.

// in view where user would select locations to manage
@if(auth()->user()->locations->count())
    @foreach(auth()->user()->locations as $location)
        <a href="{{route('location.show', $location)}}">{{$location->name}}</a>
    @endforeach
@endif

// LocationsController assuming you are using route model binding...
public function show(Location $location) {
    // make sure this user has permission to view the location. (requires a policy class)
    $this->authorize('view', $location);

    //return a view that show the details of the location and has a button on it to edit the location
    return view('location.show')->withLocation($location);
}
26 Nov
1 week ago

Drfraker left a reply on Call To A Member Function Can() On Null

@jackjones you can test it manually but I recall it does perform a check to determine if there is an authenticated user present. Which would prevent you from having to do it :) Also, it just looks so much better without the @if(auth()->user()->can('do-shit', ToSome::class) logic in the view. Just my opinion though.

Mostly I wanted to point out that it would work as I suggested for other people that read this post.

Drfraker left a reply on Call To A Member Function Can() On Null

@talinon It is a helper for the auth()->user()->can() method but it performs a check of an authenticated user out of the box. @jackjones you won't get the error if you use the blade helpers and they look cleaner, IMHO.

Hope that helps...

Drfraker left a reply on Call To A Member Function Can() On Null

This might be what you're looking for.

@can('update', $post)
    <!-- The Current User Can Update The Post -->
@elsecan('create', App\Post::class)
    <!-- The Current User Can Create New Post -->
@endcan

The can() method is on the user object. If the user is null there is no can() method to run, hence the error. Null has not method can()

24 Nov
2 weeks ago

Drfraker left a reply on Pass Response Data To The Parameters Of Another AJAX Request With AXIOS

methods: {

    getSchedule() {
        axios.get('/get-schedule', params).then(response => {
            this.getClassroom(response.data.schedule.classroom_id)
        })
    },

    getClassroom(roomId) {
        axios.get('/get-classrooms', params {                                           
                    classroom_id: roomId
        }).then(response => {
            console.log(response.data);
        })
    } 
}
19 Nov
2 weeks ago

Drfraker left a reply on Sort A Collection According To An Array Of IDs In Laravel

You can use collection methods for this:

$grids_arr = collect([11,10,1]);

$sorted = $ids->map(function($id) use($categories) {
    return $categories->where('cat_id', $id)->first();
});

18 Nov
3 weeks ago

Drfraker left a reply on Live Pair Programming

@ianfain It is a site I'm working on that will make pair programming really easy to set up and record. It's especially for situations where you have a problem and want to get live help from other dev's that you may or may not know. I'll have more time to add to the site next week and hopefully make things easier to use and open to more people.

Drfraker left a reply on Using Imagick With Valet?

You might have to enable it in the php.ini file or one that it is loading. You can determine if it is loaded in your php by going to the command line and typing php -i | grep Imagick if that command returns any information about Imagick then it is loaded. If not you are not loading php with Imagick included.

Drfraker left a reply on Code Review With If, Switch, Foreach

Start by creating a new class for each thing you are doing in the switch statement and each if statement. You will begin to see patterns in your code that you will be able to further abstract as you go down that path. Show your code as you go if you have more questions.

15 Nov
3 weeks ago

Drfraker left a reply on Live Pair Programming

@CRONIX - I see your point. I'm trying to test the workflow. When I'm done all of the sessions will be recorded and saved with shareable links. It turns out manually testing pair programming with live screen share and code editors is hard to do alone. :)

Drfraker started a new conversation Live Pair Programming

If you're looking for some help with a Laravel related issue I'm available this afternoon for live pair programming. Hit me up on https://devallies.com/drfraker

Drfraker left a reply on Unable To Find Service Provider Class In Laravel

Your /vendor folder is ignored from version control. When you move files to a server you have to add the files back. To do that you run composer install from the root of you project. It will look at composer.lock and install all the packages for your application in a /vendor folder.

14 Nov
3 weeks ago

Drfraker left a reply on Guzzle Hangs Laravel Application

Use queued jobs for async stuff in laravel https://laravel.com/docs/5.7/queues

Drfraker left a reply on "We Can't Find A User With That E-mail Address" On Password Reset

This might be easiest in person. I can help you live over at https://devallies.com/drfraker. It's a free pair programming site.

Drfraker left a reply on Unable To Find Service Provider Class In Laravel

You might need to run composer install on your server. Depending on how you are deploying this project.

12 Nov
3 weeks ago

Drfraker left a reply on Jeffery Ways "Favorite This"

 @if ($favorited = in_array($listing->id, $favorites))
                                {{ Form::open(['method' => 'DELETE', 'route' => ['favorites.destroy', $listing->id]]) }}

you don't pass favorites to the view you are passing$listings

Drfraker left a reply on Remove Value From Request Inside FormRequest

use this: $request->offsetUnset('foo');

Drfraker left a reply on File .env

In your application you only want to use the env() helper in the config/your-config.php files. In your example you might make a config file called theme and it would return an array of theme settings. Within the rest of your app you want to call the config() helper to get the values. so instead of env('THEME') you would do config('theme.theme-image')

10 Nov
4 weeks ago

Drfraker left a reply on Live Pair Programming

@ironyh let's do this devallies.com/@drfraker

Drfraker left a reply on Live Pair Programming

@CRONIX - Yeah totally. At the same time though I was telling people that I would help them live when I replied to their questions here and no one did that either. To be fair, I'd be skeptical too...

Drfraker left a reply on Live Pair Programming

@JONPEMBY - @jonpemby I will be doing them off and on for a while. It is surprisingly hard to get anyone to take me up on it. I think people are skeptical that it is really free with no strings attached.

09 Nov
1 month ago

Drfraker left a reply on Column Not Found: 1054 Unknown Column '0' In 'field List' (SQL: Insert Into `product_order` (`0`, `order_id`, `product_id`) Values (172, 21, Price))

You don't have to specify the column name in the attach method.

try: $order->product()->attach($arr_idi);

Drfraker started a new conversation Live Pair Programming

I built a new website that makes pair programming between developers easier. I'm looking at doing some testing by pair programming with a few laracasts users, for free of course.

If you need help with a laravel related problem, I'll be available for live help for the next 30-45 minutes. Request live help at https://devallies.com/drfraker . Or just check out the site and give me feedback.

Of course I'll continue helping people on the forums in the mean time.

Drfraker left a reply on How Do I Test Login Throttling?

Let's say your requirements are to lockout after 5 attempts in a minute time period.

-First test by adding 5 separate login attempts and assert that they are successfully redirected back to the login page without the lockout and then a final login attempt and assert that it receives the error and is redirected with a message, or whatever is important to your test.

-Second test that after the 1 minute wait the user can make a successful login. Use the Carbon's setTestNow() method to set the time for the test to a known time. Like maybe set it to now()->setTestNow(now()->parse('jan 1, 2018 12:00 pm')); Follow the same steps as the first test then move test now a more than a minute forwared now()->setTestNow(now()->parse('jan 1, 2018 12:02 pm')); and login one more time asserting that the user was able to successfully attempt login.

Drfraker left a reply on It Could Be More Simple To Change The Nova Logo Image

I recently did this for a customer's site and it's pretty easy to change the logo for login/admin page. I can walk you through it live over on https://devallies.com if you want me to.

Drfraker left a reply on Guzzle Hangs Laravel Application

Well PHP typically runs synchronously so it would make sense that the application has to wait for Guzzle to return the response from the API. Were you expecting something different, or am I not understanding your question.

Drfraker left a reply on Logout Not Working.

I can help you live on https://devallies.com if you use VS Code. Might be easier.

Drfraker left a reply on Table.ajax.url

It's JavaScript.

You have a table object that contains an ajax object that has a method called url on it. The url method that is accepting a url variable with a dynamic query string parameter called date which has a value of whatever is returened from the jQuery call. After this it is calling a load method.

Drfraker left a reply on What's The Best Way To Cache Frequently Requested Data

Redis is easy. You can use the Cache::remember() method to do the caching part. You'll have to add a cache()->forget('key') in the method that you use to update the widget to clear it out.

I can walk you through it on devallies.com if you want me to.

Drfraker left a reply on Logout Not Working.

@geekshubh, like @munazzil says it would be helpful to show us the list of routes in your application by opening the terminal and typing php artisan route:list | grep logout. Can you do that? Also list the logout method from the AuthenticatesUsers trait.

Drfraker left a reply on Logout Not Working.

@MUNAZZIL - One is a get and the other is a post. That should be fine

08 Nov
1 month ago

Drfraker left a reply on Store Multiple Image Path In One Column Separated By ;? Yay Or Nay?

You still have to separate the images in PHP after the query returns the result which will take time too. The database is faster than you think, and this will never be a bottleneck I would bet my life on it. Don’t reinvent the wheel.

Drfraker left a reply on Store Multiple Image Path In One Column Separated By ;? Yay Or Nay?

Why? Database rows are essentially free.

Drfraker left a reply on Custom LoginController For Nova

If you want I can walk you through it on https://devallies.com.

Drfraker left a reply on Custom LoginController For Nova

You can copy the file: "nova/resources/views/auth/login.blade.php" to your own apps resources folder. Put it in the exact same folder structure as in the /nova folder. Then edit that file in your resources folder and change the login route on the login form's method action to the route you want to use.

24 Oct
1 month ago

Drfraker left a reply on SoftDeletes() In Migration Not Creating 'deleted_at' Column

If this table already existed and the migration had run and then you added softDeletes() method you will not see the deleted_at column because the migration has already run. You will have to do a migrate:fresh to remove all the tables and re-run the migration. Warning! this will delete all of the data in your database.