brentxscholl

brentxscholl

Member Since 4 Years Ago

North Battleford, Sask

Experience Points 20,390
Experience Level 5

4,610 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 284
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.

26 Jul
3 weeks ago

brentxscholl started a new conversation Touring A New User Around Your Site

Hello,

Just wondering if anyone has experience and/or thoughts on how to tour an authenticated user around your site.

I have a ui that I want to tour my user around when they first enter the dashboard. I've looked at some great JS plugins to do this https://xbsoftware.com/products/enjoyhint/ and http://bootstraptour.com/

The question is, how do you go about triggering a tour for a user when they first enter the dashboard and how do you stop it so every time after it will not trigger? (A new column on the users table? A new user-tour table?)

What if you have multiple pages/sections (multiple tours) that you want to tour , but not until the user navigates to them for the first time?

Would love to hear your thoughts!

Thanks!

24 Jun
1 month ago

brentxscholl left a reply on Handling Image Uploads For A Model That Has Not Been Created Yet

@BOBBYBOUWMANN - Thanks a lot for the reply! Option one sounds like the best option using a temp folder and cronjob. Great stuff! Thanks again for the help!

23 Jun
1 month ago

brentxscholl started a new conversation Handling Image Uploads For A Model That Has Not Been Created Yet

In my project I want my users to be able to post Events.

Events have a title, description, price, date, start time, end time, images, etc.

When a user is creating an event, I want them to be able to upload images as well.

This image upload form is on the same page as the event creation form.

I'm using an ajax image uploader so that the user can see image thumbnails in real time and drag and drop the image order. (user selects an image from device, it automatically uploads using ajax, and the image thumbnail sections updates on successful ajax call showing the newly added image(s). this ajax form is outside the events form, but on the same page)

The problem is that when I upload the images using ajax to show on the page, the Event has not yet been created by the user so an event_id can not be attached to the Image model.

It works if I'm editing an Event because there is an event_id for the image model.

How do I handle adding images using an ajax image uploader to an event that has not yet been created? Is there a way to store them in the session and if the user does not create the event (navigates away from/ refreshes the page) the images are removed/not saved.

Note: This would be a heck of a lot easier if i just used a multifile input in my form, but for the sake of User Experience, it is required that the user instantly see thumbnails of the images they plan on attaching to the event and be able to drag drop, and delete them on the fly, while in the process of creating events.

11 Apr
4 months ago

brentxscholl started a new conversation How To Get The State Or Province Using Geocoder Php

I'm wanting to reverse geocode coordinate to get the address using Geocoder-php. I'm able to get the Address Collection using $geo = app('geocoder')->reverse($lat, $lng)->get()->first().

According to these docs found on github for Geocoder-php you can retrieve the properties form the collection, such as street name by using $geo->getStreetName(), the city by using $geo->getCity(), the country by using $geo->getCountry(), etc, but there are no methods for returning the State or Province.

How do I grab the state or province from the collection?

I can see the province when I use $geo->getAdminLevels()->get(). Which returns

    AdminLevelCollection {#900 ▼
      -adminLevels: array:2 [▼
        1 => AdminLevel {#901 ▼
          -level: 1
          -name: "Saskatchewan"
          -code: "SK"
        }
        2 => AdminLevel {#902 ▼
          -level: 2
          -name: "Division No. 16"
          -code: "Division No. 16"
        }
      ]
    }

But I am unable to grab the province (Saskatchewan).

(I am using Laravel Geocoder for a Laravel project.)

04 Apr
4 months ago

brentxscholl started a new conversation Remember What Models A User Has Viewed

Say I have a bunch of Rental Properties listed on my home page (Property model), each rental has their own page to view more details. Is there an effective way to remember which Rental Properties (Property model) an authenticated user has viewed? That way I can do something like change the color of the Rental Property's title to green for the user if not viewed and grey if viewed, etc.

13 Mar
5 months ago

brentxscholl started a new conversation Grouping Collection's Relationships Together

Sorry, I'm not exactly sure how to title this question. I am making a booking platform where, a user can book an activity.

Each activity is available on custom set days, and each day has different time slots available, and each time slot as a limited number of spots.

A user can book only a single day at a time. In that booking they can select multiple time slots they want to book, and can select how many spots for each time slot they want to book.

To achieve this I have 3 models: Activity, Booking, BookingSpot

Relationships:

Activity->hasMany(Booking)

Booking->belongsTo(Activity)
Booking->hasMany(BookingSpot)

BookingSpot->belongsTo(Booking)

Booking has a field called date that determines what date the booking is for, and activity_id that determines what activity the user booked.

BookingSpot has a field called start_time and end_time (this is how I determine the time slot), and booking_id that determines what booking it belongs too.

I want to show a schedule for the activity. Showing each time slot that has bookings and the spots that have been booked.

Here is what I'm currently doing:

            // Get all bookings for a particular day and group them by the Activity.
            $query = Booking::select('*');
            $date = date('Y-m-d', strtotime($date));
            $queryDate = BookingSpot::select('booking_id');
            $queryDate->where(DB::raw("date(start_time)"), '=', $date);
            $bookingIdArray = $queryDate->orderBy('start_time', 'ASC')->get()->toArray();
            $bookings = $query->whereIn('id', $bookingIdArray)->get()->groupBy('activity_id');

This returns all the bookings group by activity, but each booking could have multiple spots each with different start_time

How do I make a new collection from this that contains all the correct BookingSpots, that is grouped by start_time?

Edit: Here is a little chart to try to visually explain

userA, userB, userC, userD, userF all made a booking for March 24, 2019 for ACTIVITY

Here is what i am currently able to do

MARCH 24, 2019
ACTIVITY---|---userA-|-1:00PM
           |         |-1:00PM
           |         |-2:00PM
           |         |-2:00PM
           |
           |---userB-|-1:00PM
           |
           |---userC-|-1:00PM
           |         |-1:00PM
           |
           |---userD-|-2:00PM
           |
           |---userF-|-2:00PM



Here is what I want to accomplish

MARCH 24, 2019
ACTIVITY---|---1:00PM-|-userA
           |          |-userA
           |          |-userB
           |          |-userC
           |          |-userC
           |
           |---2:00PM-|-userA
                      |-userA
                      |-userD
                      |-userF
05 Mar
5 months ago

brentxscholl started a new conversation Efficiently Count Model Multiple Times Based On Column's Value

I'm wondering if there is a better way to do this (or if I'm doing this right). I have a Booking Model, on the page I want to display a count of bookings in different states, based on a status column.

Right now I feel like I'm making too many calls to the database? Here is my code in my controller.

$pendingCount = Booking::where('status', 'pending')->count();
$canceledCount = Booking::where('status', 'canceled')->count();
$finishedCount = Booking::where('status', 'finished')->count();
ect...

Is this making 3 separate calls to the database? Is there a way I can make one call to get all bookings then "filter" them based on the status and count? I'm worried I'm not being efficient enough with Elloquent.

13 Oct
10 months ago

brentxscholl left a reply on Undefined Index: Secret Error When Sending Email

Yes in my live environment I'm using mailgun. In my local environment I'm trying to use mailtrap. But on my local environment I'm getting an error for mandrill. I do not have any idea why i would be getting a mandrill error when nothing in my local environment is using mandrill.

brentxscholl left a reply on Undefined Index: Secret Error When Sending Email

I checked the stack and the call is coming from the controller that I included in the question. It then flows up through Illuminate classes. There is no call from any packages. (sorry I'm not very advanced so hopefully that explanation makes sense)

I haven't added any packages form the time it was working till now. I only created a git repository and pushed my project to Laravel forge. In forge I updated my env to point to mailgun.

12 Oct
10 months ago

brentxscholl left a reply on Undefined Index: Secret Error When Sending Email

If I set the mandrill secret to null I get a cURL error.

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

I wonder if the main issue has something to do with Laravel Forge?

I had my project on a live server using github and forge, where I'm hooking into mailgun, but still I do not know why it's looking for mandrill.

Does forge create any files that could be causing the issue?

I'm using v5.6

brentxscholl left a reply on Undefined Index: Secret Error When Sending Email

Thanks for the reply @Cronix

I did the php artisan config:clear

and still no luck.

After running config('mail') this is what my response was:

>>> config('mail')
=> [
     "driver" => "smtp",
     "host" => "smtp.mailtrap.io",
     "port" => "2525",
     "from" => [
       "address" => "[email protected]",
       "name" => "Appname",
     ],
     "encryption" => null,
     "username" => "83[my-username]0b",
     "password" => "be[my-password]1b",
     "sendmail" => "/usr/sbin/sendmail -bs",
     "markdown" => [
       "theme" => "default",
       "paths" => [
         "C:\my-app-path\resources\views/vendor/mail",
       ],
     ],
   ]
>>>

brentxscholl started a new conversation Undefined Index: Secret Error When Sending Email

I'm trying to use Mailtrap to send an email but my app keeps thinking Im trying to use mandrill? I'm not sure why this is happening

The Error is: ErrorException (E_NOTICE) Undefined index: secret

According to the error this is the code that is causing the problem vendor\laravel\framework\src\Illuminate\Mail\TransportManager.php

protected function createMandrillDriver()
    {
        $config = $this->app['config']->get('services.mandrill', []);
 
        return new MandrillTransport(
            $this->guzzle($config), $config['secret'] // This line
        );
    }

Here is my controller that is is sending the file

if(Auth::user()->activated !== 1)
        {
            \Mail::to(Auth::user())->send(new Activate(Auth::user()));
            return redirect()->back();
        }

My config/mail.php file is the default from laravel

My .env file

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=83ff[...MY USERNAME...]aadf
MAIL_PASSWORD=bab[...MY PASSWORD...]8asdf
MAIL_ENCRYPTION=null

My config\services.php is also the default.

I did a search for the mention of Mandrill in my code and could not find anywhere where I'm stating mandrill.

Does anyone have any thoughts on what could be the issue?

03 Oct
10 months ago

brentxscholl left a reply on Password Protect A Deployed Site That Uses Authentication So A Client Can See, But No One Else.

Thanks for the info guys! Looks like there are a few options.

My client is remote. So it has to be put online. They will need changes once they see the project, so having it in an "Under Construction" mode would work the best.

brentxscholl started a new conversation Password Protect A Deployed Site That Uses Authentication So A Client Can See, But No One Else.

Say I have a Laravel project completed and I want to deploy the site online to my client's server. However for the first 2 weeks my client will want to go over the site and confirm it's functionality.

During this time we would not want anyone else to visit the domain and see the site. The site should only be viewable to my client and who ever else they approve. I would achieve this by giving my client some kind of password to view the site.

The Laravel project already contains a user login system to show pages that are already protected by Authentication. ie. account pages. However the site has pages that are not protected by Authentication such as the home page, login page, registrations page, etc.

So, how would I create a temporary default landing page that is simply just a password input, that my client can use to enter a password and proceed to the site?

Note: This should not "Authenticate" my client to see the account pages that were already protected. They should be able to now see the home page, register page, login page etc. but will still have to register and login to see the account pages.

01 Oct
10 months ago

brentxscholl left a reply on Sending Transactional Emails And Using A Mailbox

That sounds like a good idea. I'm currently using hover to manage my domain. I will look into this option. Thanks!

brentxscholl started a new conversation Sending Transactional Emails And Using A Mailbox

Hi there,

I'm wanting to send Transactional Emails on my site when a user signs up (and triggers other reasons for the site to send an email). I also want to have personal emails set up for my employees, ie. [email protected], [email protected], etc.

I'm seeing options like Mailgun and Mandrill for transactional emails and Google Apps for mailbox that can use my domain. ([email protected])

When ever i used a common cpanel based server, i could easily set up a couple emails addresses, but I do not see this in forge. Ideally I'd rather not spend a bunch of money for a google business email so i can create a regular old email, like [email protected]

Does anyone have any recommendations on what email service to use?

Thanks!

25 Sep
10 months ago

brentxscholl left a reply on Scroll To An HTML Element When Returning A View

Thanks for the reply! I like the passing a variable idea.

Here's what I did:

Controller

    $scroll = true;
    return view('view.name', compact('scroll'));

In the view I added some js

    $(document).ready(function () {
        @if($scroll)
            $('html, body').animate({
                scrollTop: $('#element').offset().top
            }, 'slow');
        @endif
    });

brentxscholl started a new conversation Scroll To An HTML Element When Returning A View

I know I can redirect to a route and scroll to an HTML element by doing:

return redirect()->route('route-name', [ '#element'])

How can I do the same thing but when creating a view?

return view('view.name', compact('some-variable')); // scroll to #element

Is this possible?

18 Sep
11 months ago

brentxscholl left a reply on Paginating Grouped By Notifications

This worked for me

use Illuminate\Pagination\LengthAwarePaginator as Paginator;

public function show(Request $request)
{
        $page = $request->has('page') ? $request->input('page') : 1; // Use ?page=x if given, otherwise start at 1
        $numPerPage = 5; // Number of results per page
        $userNotifications = Auth::user()->notifications();
        $count = $userNotifications->count(); // Get the total number of entries you'll be paging through
        // Get the actual items
        $notifications = $userNotifications
            ->take($numPerPage)->offset(($page-1)*$numPerPage)->get()->groupBy(function($q) {
                return Carbon::parse($q->created_at)->format('d M Y');
            });
        // Create the paginator with Illuminate\Pagination\LengthAwarePaginator as Paginator
        // Pass in the variables supplied above, including the path for pagination links
        $paginator = new Paginator($notifications, $count, $numPerPage, $page, ['path' => $request->url(), 'query' => $request->query()]);


        return view('notification.timeline', compact('notifications', 'paginator'));
}

The view is the same, replace {{ Auth::user()->notifications()->paginate(10)->links() }} with {{ $paginator }}

brentxscholl left a reply on Paginating Grouped By Notifications

Thanks for the help @jlrdw . I'm an noobie and this is still very confusing. How can I make this work with the above groupBy query and in the controller?

brentxscholl started a new conversation Paginating Grouped By Notifications

I am trying to display all notifications on a page and group them by day (to show a time timeline), but I am unable to properly paginate the notifications.

Here is my code:

View:

               @foreach ($notifications as $day => $notifications)
                    <div class="row notification-day">
                        <div class="col col-sm-2">
                            <div class="notification-date">
                                <p>{{ $day }}</p>
                            </div>
                        </div>
                        <div class="col col-sm-10">
                            <div class="notification-date-list">
                                <ul>
                                    @foreach($notifications as $n)
                                        <li>
                                            @include ('notification.timeline.' . snake_case(class_basename($n->type)))
                                        </li>
                                    @endforeach
                                </ul>
                            </div>
                        </div>
                    </div>
                @endforeach 

                  //......
                 {{ Auth::user()->notifications()->paginate(10)->links() }}

My controller

        $notifications = Auth::user()->notifications()->paginate(10)->groupBy(function($q) {
            return Carbon::parse($q->created_at)->format('d M Y');
        });


        return view('notification.timeline', compact('notifications'));

but this of course does not work. It does work fine if i remove the pagination attemp. all the notifications show on the page and are group as desired.

How can I group notifications by day, so I can separate the notifications on the page by the day, and also properly paginate?

Thanks!

31 Aug
11 months ago

brentxscholl left a reply on Laravel Cashier Subscriptions For Featured Posts

I figured it out!

Add a new migration to update subscription model

public function up()
    {
        Schema::table('subscriptions', function($table) {
            $table->integer('post_id')->nullable()->after('user_id');
        });
    }

public function down()
    {
        Schema::table('subscriptions', function($table) {
            $table->dropColumn('post_id');
        });
    }

Create a Subscription Model and extend Laravel Cashier Subscription model. Which will let you specify new relationships and methods while giving you access to all other methods in the Laravel Cashier Subscription model

<?php

namespace App;

use Laravel\Cashier\Subscription as CashierSubscription;

class Subscription extends CashierSubscription
{
    public function yourCustomMethod()
    {
        // your custom code here
    }
}

Update User model for the new Subscription Model

**
     * Get all of the subscriptions for the Stripe model.
     *
     * @return \Illuminate\Database\Eloquent\Collection
     */
    public function subscriptions()
    {
        return $this->hasMany(\App\Subscription::class, $this->getForeignKey())->orderBy('created_at', 'desc');
    }

Be sure to add your relationship for Post and Subscription (see @aurawindsurfing answer)

Create the subscription for the post in the 'PostController' or where ever you want


Stripe::setApiKey(config('services.stripe.secret'));

// create the subscription
$subscription = Auth::user()->newSubscription('featured', 'featured_post')->create(request('stripeToken'));

// get the post
$post = Post::find(1);

//Link post and subscription
$subscription->post_id = $post->id;
$subscription->save();

$post->subscription_id = $subscription->id;
$post->save();

brentxscholl left a reply on Laravel Cashier Subscriptions For Featured Posts

@aurawindsurfing Ok. Thanks a lot for the help! I think I can imagine a way to make this work.

A problem I'm having is getting the idof the subscription after the subscription is created

            $user->newSubscription('featured', 'weekly')->create(request('stripeToken'));

Now I need to grab the id of that newly created subscription. But searching the docs I can not find a way to do this.

brentxscholl left a reply on Laravel Cashier Subscriptions For Featured Posts

Ideally I would add a field to the subscriptions table that is post_id. That way I know that post belongs to that subscription, but I don't know how to do this.

brentxscholl left a reply on Laravel Cashier Subscriptions For Featured Posts

@aurawindsurfing Thanks for the reply, but it's not a matter of if the user is eligible to post premium content.

Featured posts can be made by any user. I need a way to check if a post is a featured post and if the user has paid for it (the subscription is active)

With laravel cashier I can check if a user is subscribed for a premium account, but I don't know how to check if a post is subscribed to be featured by the post owner.

30 Aug
11 months ago

brentxscholl started a new conversation Laravel Cashier Subscriptions For Featured Posts

I am currently using Laravel Cashier for my users so they can subscribe for premium accounts.

I also want to let my users make Featured Posts that are different from regular posts.

I want to charge $10/week for a featured post. I assume a laravel cashier subscription would work for this.

But I do not know how to link the Post, the user, and the subscription together with laravel cashier.

How do i know when a subscription for a specific post is over? A user could have multiple featured posts.

So when the featured post subscription ends the post will no longer be a featured post.

Does anyone know how this can be done?

23 Aug
11 months ago

brentxscholl started a new conversation User Can Favorite A Post And Also A User

I'm having a hard time figuring out this relationship

I have a User model, a Post model, and a Favorite model

I want my users to be able to Favorite both posts and other users

Here is my User.php

public function favorites()
    {
        return $this->belongsToMany('App\Post', 'favorites')->withTimestamps();
    }

Post.php

public function favorites()
    {
        return $this->hasMany('App\Favorite');
    }

Favorite.php

public function user()
    {
        return $this->belongsTo('App\User');
    }

My favorites table looks like this

Schema::create('favorites', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->integer('post_id')->nullable();
            $table->integer('outfitter_id')->nullable();
            $table->integer('user_id')->unsigned();
            $table->timestamps();
        });

The outfitter_id belongs to the User model.

(The post_id and the outfitter_id are the items being Favorited. the user_id is the user who Favorited the item.)

How can I make this relationship work?

14 Aug
1 year ago

brentxscholl left a reply on Collecting Payment From User_A And Depositing Payment To User_B In Laravel

Hi @aurawindsurfing Thank you so much for the info! This helps a lot

I'm just looking into Strip Connect with Custom accounts. If you are familiar with this, do you know what a user interface would look like for a user? Is it easy for a user to set up a connect account? If you know off hand of any resources for custom stripe connect account user interfaces that would be much appreciated!

Thanks a lot for the info regardless!

12 Aug
1 year ago
11 Aug
1 year ago

brentxscholl started a new conversation Collecting Payment From User_A And Depositing Payment To User_B In Laravel

I am building a Laravel website that facilitates services for our users. A user can post a service on the site and other users can book/pay for that service through the site.

Easy Part: The website is free for anyone to sign up, but I also want to have Premium accounts with extra features that a user can pay a monthly subscription for. I feel like Laravel Cashier can work great for this.

Hard Part: User_A can post services online (ie offer a cooking class for $30). User_B can book/pay User_A for a service (ie. pay $30 for a cooking class)

How can I collect payment from User_B, and deposit that payment to User_A? (there would be some logic so the website keeps a cut/fee)

For an easy example we are doing something similar to Uber. A passenger pays for a ride, and a drive gets paid to drive the passenger. It is done through Uber and Uber keeps 25%.

Does anyone have any advice on how this can be done in Laravel?

This is a tricky problem and I'm having trouble finding a way to do this.

Much appreciated!

01 Aug
1 year ago

brentxscholl left a reply on Laravel Cashier For Subscription Based Payment And One Time Payments

So does this mean the user has to be a subscribed user in order to make a one time charge? Or is it possible for a user, who is not subscribed, be able to make one time payments by entering their credit card info in a check out form?

31 Jul
1 year ago

brentxscholl left a reply on Laravel Cashier For Subscription Based Payment And One Time Payments

@Cronix Thanks for your reply!

This is the confusion I have:

The docs say

"If you would like to make a "one off" charge against a subscribed customer's credit card, you may use the charge method on a billable model instance."

$user->charge(100);

But that is assuming the user already has a subscription with credit card credentials.

So does this mean the user has to be a subscribed user in order to make a one time charge? Or is it possible for a user who is not subscribed be able to make one time payments by entering their credit card info in a check out form?

brentxscholl started a new conversation Laravel Cashier For Subscription Based Payment And One Time Payments

I'm setting up a booking style website where a user can buy a monthly subscription to be a premium user with extra features. I believe Laravel Cashier would work great for this.

I am also wanting my users (who are not premium) to be able to make one time payments (bookings) on the site.

However, I'm reading that for one time payments I need to use the Strip/Braintree SDK

Is there a way to do both Subscription based payment and one time payment using Laravel Cashier?

Thanks

31 May
1 year ago

brentxscholl started a new conversation Multiple Image Upload With Drag And Drop Sorting

Hi there,

Just curious if anyone knows of any tutorials or packages for creating/adding a multi image upload feature that has drag and drop sorting.

Ideally I would like my users to be able to add images to their posts and be able to sort the images by dragging and dropping. Hopefully I can use ajax to make this all seamless.

I've tried searching google, but mainly get results for multi image uploading, or dropzone.js, but nothing for image uploading and drag and drop sorting.

Thanks a lot!

10 May
1 year ago

brentxscholl started a new conversation Grabbing The #id In A Url

I have a page.blade.php set up that is using bootstrap tabs and panels.

Each tab has an id. When a tab is clicked the url is updated with the id.

ie. if you click the media tab the url changes to example.com/page?#media if you click the description tab the url changes to example.com/page?#description

I have js code on this page to grab the url, check the parameters ie. #media, and open the associated tab/panel.

So if you visit example.com/page?#media the media panel will be showing. If you visit example.com.page?#description the description panel will be showing.

Is there a way in laravel that I can check the url and preform conditions based on the result?

What I want to do is:

@if($pageUrl == "#media")
do this
@elseif($pageUrl == "#description")
do that
@endif 
28 Apr
4 years ago

brentxscholl started a new conversation Adding A Sub Domain With Laravel Forge

I currently have a site live using Laravel forge. In my Active Sites section I have one domain that is holding my website. The Wildcards column is set to inactive. I'm very new too all this and I don't want to loose my site data (mainly images that are being stored in my public directory). I'm trying to set up a sub domain for my mobile site. m.example.com. How can I do this with my current site? I'm having trouble finding an option to set my current domain's Wildcard to active.

If I set up a new domain that "Allow Wildcard Sub-Domains" on the same server, will I loose my repository (loose my images that are stored on my public directory)? I'm worried about messing with this stuff. Can any help me out? Thanks!

14 Apr
4 years ago

brentxscholl started a new conversation Timezoning

In my project I'm wanting to show the correct created_at->diffForHumans() based on a users time zone.

In my user's table I'm storing the users timezone that they specified when creating their account.

in my routes file I have

if (Auth::user())
   {
       $timezone = (Auth::user()->timezone) ? Auth::user()->timezone : Config::get('app.timezone');
       date_default_timezone_set($timezone);
    }

This will display the correct time according to the user,based on the users time zone.

However!

Now when a user posts to the database the created_at timestamps are no longer the default UTC timezone and are the time based on the users timezone, resulting in some post dated into the future and other dated into the past, according to the users time zone!

Does any one know a way around this?

11 Apr
4 years ago

brentxscholl left a reply on Pagination Not Working In Forge, But Works On Local Machine

Im not sure if this is a correct fix but in my .gitignore file I removed /vendor so my vendor/laravel/framework/src/illuminate/Pagination/BootstrapPresenter.php is added

It all works now

brentxscholl started a new conversation Pagination Not Working In Forge, But Works On Local Machine

I'm using Laravel 4.2.16 simplePaginate in my project to create a facebook style image viewer. On my local VM it works flawlessly. However, when I install my repository onto my live server using forge, this is the only thing on the site that now does not work.

On my live server the next & prev links are not showing.

I'm using a custom pagination layout.

Here is my code: Controller

public function imageViewer($id)
    {
        $images = $this->mediaRepository->getPaginatedImages($id);
        return View::make('image-viewer', compact('images'));
    }

// media repository
public function getPaginatedImages($id)
    {
        $post = Resource::where('id', $id)->first();
        return Media::with(['comments' => function($query) {
            $query->with('likes');
        }])->with('likes')->where('resource_id', $post->id)->simplePaginate(1);

    }

View

      <div class="image-viewer-image">
            <div class="image-viewer-image-container">
        <!-- *** Im using UIKIT (css bootstrap), uk-overlay is a container for the hidden uk-overlay-area, this hides the div until the user mouses over it. this all works on local machine *** -->
                <div class="uk-overlay">
                    <img src="{{ URL::asset("images/users/{$image->url}") }}" class="scale" data-scale="best-fit-down" data-align="center">
                    <div class="uk-overlay-area">
                        {{ $images->links('php_includes.pagination.slider') }}
                    </div><!-- uk-overlay-area end -->
                </div><!-- uk-overlay end -->
            </div><!-- image-viewer-image-container -->
        </div><!-- image-viewer-image end -->

Here is the php_includes.pagination.slider view:

<?php
    $presenter = new Illuminate\Pagination\BootstrapPresenter($paginator);
    $trans = $environment->getTranslator();
?>
<?php if ($paginator->getLastPage() > 1): ?>
    <ul class="image-viewer-prenext-container">
        <?php
            echo $presenter->getPrevious($trans->trans('pagination.previous'));
            echo $presenter->getNext($trans->trans('pagination.next'));
        ?>
    </ul>
<?php endif; ?>

within my vendor/laravel/framework/src/illuminate/Pagination/BootstrapPresenter.php i have

<?php namespace Illuminate\Pagination;

class BootstrapPresenter extends Presenter {

    /**
     * Get HTML wrapper for a page link.
     *
     * @param  string  $url
     * @param  int  $page
     * @param  string  $rel
     * @return string
     */
    public function getPageLinkWrapper($url, $page, $rel = null)
    {
        $rel = is_null($rel) ? '' : ' rel="'.$rel.'"';

        return '<li><a href="'.$url.'"'.$rel.'><div class="image-viewer-'.$page.'"></div></a></li>';
    }

    /**
     * Get HTML wrapper for disabled text.
     *
     * @param  string  $text
     * @return string
     */
    public function getDisabledTextWrapper($text)
    {
        return '<li class="disabled"><div class="image-viewer-'.$text.'"></div></li>';
    }

    /**
     * Get HTML wrapper for active text.
     *
     * @param  string  $text
     * @return string
     */
    public function getActivePageWrapper($text)
    {
        return '<li class="active"><div class="image-viewer-'.$text.'"></div></li>';
    }

}

Like i said before this pagination work on my local machine, but when its on my live server with laravel forge this is the only thing on my site that no longer works.

Here is a comparison of the code using firebug:

Local machine: http://s15.postimg.org/idjl5kl5n/localmachine_pag.png

Live Server: http://s3.postimg.org/p67ay5npf/liveserver_pag.png

The main differences I see is within the <ul> it's not picking up the changes I made in vendor/laravel/framework/src/illuminate/Pagination/BootstrapPresenter.php

Anyone have any ideas why this is happening? let me know if I need to post more code.

08 Apr
4 years ago

brentxscholl left a reply on Mail Won't Send. Stuck In Pretend

This problem is driving me nuts! If anyone is interested I'm willing to pay for someone to fix this problem for me

07 Apr
4 years ago

brentxscholl left a reply on Mail Won't Send. Stuck In Pretend

@foxted Thanks for the reply!

I'm using laravel 4.2

I just tried setting 'encryption' => '' in my app/config/mail.php but im still getting

[2015-04-08 03:33:33] local.INFO: Pretending to mail message to: xxxx@xxxxx.com [] []
[2015-04-08 03:33:33] local.INFO: Xxxxx.Registration.Events.UserRegistered was fired. [] []

Is there anything else at all that could be triggering the mail to be pretend? There must be some sort of check list I could do to make sure I'm not missing anything. This is driving me nuts that I cant find it :(

06 Apr
4 years ago

brentxscholl left a reply on Mail Won't Send. Stuck In Pretend

Ok well I'm still stuck in pretend. Does anyone have a possible solution?

brentxscholl left a reply on Mail Won't Send. Stuck In Pretend

also when I dd(App::environment()); I get local not sure if that's a problem?

My bootstrap/start.php file looks like this

$env = $app->detectEnvironment(array(

    'local' => array('homestead'),

));

brentxscholl left a reply on Mail Won't Send. Stuck In Pretend

@dberry no I only have the one within my app/config/mail.php

brentxscholl left a reply on Mail Won't Send. Stuck In Pretend

@erozas Thanks for your reply. i currently have this as my code for sending the email

use Illuminate\Mail\Mailer as Mail;

abstract class Mailer {

    private $mail;

    /**
     * @param Mail $mail
     */
    function __construct(Mail $mail)
    {
        $this->mail = $mail;
    }

    /**
     * @param $user
     * @param $subject
     * @param $view
     * @param $data
     */
    public function sendTo($user, $subject, $view, $data)
    {
        $this->mail->send($view, $data, function($message) use($user, $subject)
        {
            $message->to($user->email)
                ->from('admin@acme.com')
                ->subject($subject);
        });
    }
} 

but It still sends in pretend mode.

brentxscholl started a new conversation Mail Won't Send. Stuck In Pretend

I'm trying to send mail. I followed the Laracast tutorial for sending mail with mandrill via https://laracasts.com/lessons/laravel-and-mandrill-in-minutes I also set up an event to trigger mail to send following this Laracast tutorial https://laracasts.com/series/build-a-laravel-app-from-scratch/episodes/27

Here is my app/config/app.php file

<?php

return array(

    /*
    |--------------------------------------------------------------------------
    | Application Debug Mode
    |--------------------------------------------------------------------------
    |
    | When your application is in debug mode, detailed error messages with
    | stack traces will be shown on every error that occurs within your
    | application. If disabled, a simple generic error page is shown.
    |
    */

    'debug' => false,

    /*
    |--------------------------------------------------------------------------
    | Application URL
    |--------------------------------------------------------------------------
    |
    | This URL is used by the console to properly generate URLs when using
    | the Artisan command line tool. You should set this to the root of
    | your application so that it is used when running Artisan tasks.
    |
    */

    'url' => 'http://localhost',

    /*

);

My app/config/mail.php file

<?php

return array(

    /*
    |--------------------------------------------------------------------------
    | Mail Driver
    |--------------------------------------------------------------------------
    |
    | Laravel supports both SMTP and PHP's "mail" function as drivers for the
    | sending of e-mail. You may specify which one you're using throughout
    | your application here. By default, Laravel is setup for SMTP mail.
    |
    | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log"
    |
    */

    'driver' => 'mandrill',

    /*
    |--------------------------------------------------------------------------
    | SMTP Host Address
    |--------------------------------------------------------------------------
    |
    | Here you may provide the host address of the SMTP server used by your
    | applications. A default option is provided that is compatible with
    | the Mailgun mail service which will provide reliable deliveries.
    |
    */

    'host' => 'smtp.mailgun.org',

    /*
    |--------------------------------------------------------------------------
    | SMTP Host Port
    |--------------------------------------------------------------------------
    |
    | This is the SMTP port used by your application to deliver e-mails to
    | users of the application. Like the host we have set this value to
    | stay compatible with the Mailgun e-mail application by default.
    |
    */

    'port' => 587,

    /*
    |--------------------------------------------------------------------------
    | Global "From" Address
    |--------------------------------------------------------------------------
    |
    | You may wish for all e-mails sent by your application to be sent from
    | the same address. Here, you may specify a name and address that is
    | used globally for all e-mails that are sent by your application.
    |
    */

    'from' => array('address' => 'admin@acme.com', 'name' => 'Acme'),

    /*
    |--------------------------------------------------------------------------
    | E-Mail Encryption Protocol
    |--------------------------------------------------------------------------
    |
    | Here you may specify the encryption protocol that should be used when
    | the application send e-mail messages. A sensible default using the
    | transport layer security protocol should provide great security.
    |
    */

    'encryption' => 'tls',

    /*
    |--------------------------------------------------------------------------
    | SMTP Server Username
    |--------------------------------------------------------------------------
    |
    | If your SMTP server requires a username for authentication, you should
    | set it here. This will get used to authenticate with your server on
    | connection. You may also set the "password" value below this one.
    |
    */

    'username' => null,

    /*
    |--------------------------------------------------------------------------
    | SMTP Server Password
    |--------------------------------------------------------------------------
    |
    | Here you may set the password required by your SMTP server to send out
    | messages from your application. This will be given to the server on
    | connection so that the application will be able to send messages.
    |
    */

    'password' => null,

    /*
    |--------------------------------------------------------------------------
    | Sendmail System Path
    |--------------------------------------------------------------------------
    |
    | When using the "sendmail" driver to send e-mails, we will need to know
    | the path to where Sendmail lives on this server. A default path has
    | been provided here, which will work well on most of your systems.
    |
    */

    'sendmail' => '/usr/sbin/sendmail -bs',

    /*
    |--------------------------------------------------------------------------
    | Mail "Pretend"
    |--------------------------------------------------------------------------
    |
    | When this option is enabled, e-mail will not actually be sent over the
    | web and will instead be written to your application's logs files so
    | you may inspect the message. This is great for local development.
    |
    */

    'pretend' => false,

);

my app/config/services.php

<?php

return array(

    /*
    |--------------------------------------------------------------------------
    | Third Party Services
    |--------------------------------------------------------------------------
    |
    | This file is for storing the credentials for third party services such
    | as Stripe, Mailgun, Mandrill, and others. This file provides a sane
    | default location for this type of information, allowing packages
    | to have a conventional place to find your various credentials.
    |
    */

    'mailgun' => array(
        'domain' => '',
        'secret' => '',
    ),

    'mandrill' => array(
        'secret' => 'MY SECRET API KEY IS HERE',
    ),

    'stripe' => array(
        'model'  => 'User',
        'secret' => '',
    ),

);

Now when I hit the event that triggers the email to send, I check my laravel.log file and it says this

[2015-04-06 17:47:04] local.INFO: Pretending to mail message to: example@hotmail.com [] []
[2015-04-06 17:47:04] local.INFO: Acme.Registration.Events.UserRegistered was fired. [] []

It still says Pretending even though i have 'pretend' => false, in my app/config/mail.php file. The email never sends. I'm using real emails (i'm just not displaying them in this post) Am I missing something here? What else can be triggering mail to be in pretend mode?

02 Apr
4 years ago

brentxscholl started a new conversation Laravel 4.2 Composer Install Error: Could Not Scan For Classes Inside “app/models”

In my Laravel 4.2 project I have moved my User model to a new directory within my app directory.

-app/

--Acme/

---Users/

----User.php

I then removed the app/models directory

I added this to my composer.json file

"autoload": {
    "classmap": [
        "app/commands",
        "app/controllers",
        "app/models",
        "app/database/migrations",
        "app/database/seeds",
        "app/tests/TestCase.php",
        "app/Acme/adminHelpers.php"
    ],
    "files": [
        "app/Acme/helpers.php",
        "app/Acme/adminHelpers.php"
    ],
    "psr-4": {
        "Acme\\": "app/Acme"
    }
},

I also edited my app/auth.php file

/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/

'model' => 'app\Acme\Users\User',

I then ran composer dump-autoload

I'm now trying to install my Github repository using Laravel Forge but I keep getting this error:

...
Writing lock file
Generating autoload files



   [RuntimeException]                                                                              
  Could not scan for classes inside "app/models" which does not appear to be a file nor a folder 

Does anyone know why this is happening and how to fix?

30 Mar
4 years ago

brentxscholl left a reply on I'm Having An N+1 Problem When I Try To Eager Load More Than 1 Relationship Deep.

@JarekTkaczyk Do you know if there is a difference between count($comment->likes()) vs $comment->likes->count()? Both appear to be giving the same results and don't have the N+1 problem. Is one more efficient than the other?