singh

singh

Member Since 4 Years Ago

Experience Points
1,005
Total
Experience

3,995 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
0
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.

Level 1
1,005 XP
Sep
20
1 week ago
Activity icon

Replied to Laravel 7 - Showing One Of The Columns Below All Other Columns For Each Row

Similar to Accordian. Basically the data shows up for all the columns including Description. However description shows below other columns in the same row and then if someone click on the description tab they can see it the description field.

Activity icon

Started a new Conversation Laravel 7 - Showing One Of The Columns Below All Other Columns For Each Row

Use case: A table that has a product_name, type, price, discount, final price and description columns.

Now description is a text field that can be few hundred characters.

I would like to show all other columns in one row and then right below them I would like to show Description in a row that is expandable to view. How do I go about it in blade?

Sep
16
1 week ago
Activity icon

Replied to Ajax Update - How To Append A Line Or Or Insert A New Line Without Reload

It doesn't work because my controller response returns JSON response on the screen. If I go back to my table route it shows an updated table but that is by making a database query.

return response()->json($mycompany);

I also tried Response::json(['success' => $mycompany], 200); which gives a blank screen.

Activity icon

Started a new Conversation Ajax Update - How To Append A Line Or Or Insert A New Line Without Reload

I finally got an Ajax form submission working to edit a table row. Instead of reloading the page or using a redirect via controller I would like to show the update row in my Blade Template file.

Below is my URL for invoking the update modal and my JQuery after the success <a class="btn apland-btn btn-7 btn-sm" data-toggle="modal" data-target="#editModal" data-id="{{ $tax->id }}" data-name="{{ $tax->name }}" data-rate="{{ $tax->rate }}" data-type="{{ $tax->type }}" data-defalt="{{ $tax->default }}" > Edit </a>.

My Laravel Controller returns the JSON response: return response()->json($mycompany);

My Ajax call runs the following after the successful update:

success: function(dataResult){

var dataResult = JSON.parse(dataResult);
                           
	if(dataResult.statusCode==200){
                                    $('#editForm').modal().hide();
                                    alert('Data updated successfully !');
                                    location.reload();
                            }

}

Is there a way I can update my blade template. It shows only the following fields.

'''{{ $tax->name }}"" '''{{ $tax->type }}"" '''{{ $tax->rate }}"" '''{{ $tax->default }}""

$tax->id is the row id. It is available and used to update the record but not displayed because it is not continuous for all the users. For example - Adam can have $tax->id 2, 4,5. and Brad can have 3,7,11

Sep
13
2 weeks ago
Activity icon

Replied to Pros And Cons Of Using Ajax In L7

Thanks for this effort. I was able to customize it but then ended up removing datatables because the Editor is not free and my project is not ready to pay their license fee. I had to do the good old blade way because mixing datatables with non ajax post calls meant more db queries.

Sep
12
2 weeks ago
Activity icon

Replied to Pros And Cons Of Using Ajax In L7

Yes I ended up using it. However, I am having trouble integrating my theme into it. I am using Admin LTE but not the Laravel AdminLTE pacakge. Instead I had download the AdminLTE theme and customized it using my landing page theme. But now how do I go about integrating the AdminLTE theme into the datatables. I seem to have no control over it.

Right now it looks like this:

https://drive.google.com/file/d/1tT1px-x2_AZscXOMISkA6i3XmSabO0Vz/view?usp=sharing

And I wan it to be something like this:

https://drive.google.com/file/d/1Vb6jUif4TMZSb9IKIIMUrydGAg_4gVy5/view?usp=sharing

You can ignore the human icons and progress bar and think of it as data fields.

This comes from the latests version of AdminLTE's Project page under Examples.

Sep
10
2 weeks ago
Activity icon

Started a new Conversation Pros And Cons Of Using Ajax In L7

I am building a data table where user can Add, Edit and Delete records. To perform all the functions I will be using Modals. After performing the function of course the data needs to be refreshed. Should I just use redirect to the table route in my controller or would Ajax be better? I am building a large application that may have different type of data tables. Some will show few lines per user but others may show thousands of records. Biggest concerns is performance degradation since I am using Laravel Blade for the presentation layer.

Sep
01
3 weeks ago
Activity icon

Replied to L7 - Invoking A Controller To Get Data If Clicked On A Tab

I am using blade. Are you telling me to attach the tab to an event? Any resources/samples you can point me to?

Activity icon

Replied to L7 - Invoking A Controller To Get Data If Clicked On A Tab

Thanks. A click even to trigger a route? The only way I know is href="{{ route('someroute') }}". But in this case we already have the href tag as href="#vert-tabs-settings". Thus my question.

Activity icon

Started a new Conversation L7 - Invoking A Controller To Get Data If Clicked On A Tab

Is there a way to get data only if the tab is clicked on? I am using Laravel Blade. A typical tab looks like this:

<a class="nav-link" id="vert-tabs-settings-tab" data-toggle="pill" href="#vert-tabs-settings" role="tab" aria-controls="vert-tabs-settings" aria-selected="false">Settings</a>

Here href will invoke the tab. Can it somehow be tied to a route? I am trying not to query data for five different tabs.

Aug
29
4 weeks ago
Activity icon

Replied to Laravel 7 - The Image Object From S3 Is Fetched But Cannot Be Displayed

For now I ended up making the file public at the time of storage by using the following:

Storage::disk('s3')->put($filePath, file_get_contents($file), 'public');

However, there should be a way to keep the files private and make them accessible only to the application. I was successfully able to do that with Laravel 5.1 but for some reason the same S3 drive with same API keys is not working for Laravel 7.

Activity icon

Started a new Conversation Laravel 7 - The Image Object From S3 Is Fetched But Cannot Be Displayed

Added more information based on L7 docs at the bottom.

I am successfully able to upload the file to S3 and get the object URI. However when the URI is put in the image tag, it shows a broken image. I can print the raw URI in my view as well as using dd. The $logoname below is pulled from a database query.

    $logoname = $company->logo;  
        $destinationPath = "logos/";
        $value = $destinationPath.$logoname;
        $disk = Storage::disk('s3');
        if (isset($logoname)) {
        	if ($disk->exists($value)) {
        	$command = $disk->getDriver()->getAdapter()->getClient()->getCommand('GetObject', [
        		'Bucket'                     => env('S3_BUCKET'),
        		'Key'                        => $value
         		]);
       
        $request = $disk->getDriver()->getAdapter()->getClient()->createPresignedRequest($command, '+200 minutes');
        $myuri = (string) $request->getUri();

   return view('company', compact(['myuri']
   }
   }

Based on Laravel 7 docs - as suggested by @bobbybouwmann below I have also attempted the following:

$myuri = Storage::get($value);

$myuri = $disk->get($value);

$myuri = Storage::disk('s3')->get($value);

$myuri = Storage::disk('s3')->url($value);

$myuri = Storage::disk('s3')->temporaryUrl( $value, now()->addMinutes(5), ['ResponseContentType' => 'application/octet-stream'] );

I have even set the bucket to public access.

Error if the URL pasted in browser:

<Error>

<Code>NoSuchKey</Code>

<Message>The specified key does not exist.</Message>

<Key>logos/phpSOzViN1598729897lyoDFyBoLJssn7Dbrf9ORHTV44fyr8xpOwmDSUzN6AgJDVtyZvqs4MRw2dNKFJgPvdl2UpUu6AORscvJ.jpg</Key>

<RequestId>a small string </RequestId>

<HostId>a long string with a host id</HostId>

</Error>

Activity icon

Replied to Laravel 7 - Form With A Custom CSS Doesn't Select File

for some reason i cannot post my html code here

Activity icon

Started a new Conversation Laravel 7 - Form With A Custom CSS Doesn't Select File

If I use the following code for my form that is based on Admin Lite theme - it neither selects the file nor uploads it. I can browse through files on my macbook but cannot select one. ' <div class="form-group"> <div class="input-group" > <div class="custom-file">

              ```<form method="POST" action="{{ route('logoupload') }}" enctype="multipart/form-data">```
                      ```@csrf```
                      ```<input type="file" class="custom-file-input" id="logo" name="logo">```
                      ```<input type="hidden" id="companyid"  value="{{ $company->id }}" name="companyid">```
                      ```<label class="custom-file-label" for="logo">Add / Update Logo&lt;/label>```
                  ```</div>```
                    ```<br>```
                  ```<div class="input-group-append">```
                    ```<span class="input-group-text">Upload&lt;/span>```
                  ```</div>```

                  ```</form>```

</div>

<!-- However, if I use the following code everything works fine: -->

<form method="POST" action="{{ route('logoupload') }}" enctype="multipart/form-data"> @csrf <label for="logo">Select file</label> <input type="file" id="logo" name="logo"> <input type="hidden" id="companyid" value="{{ $company->id }}" name="companyid"> <button type="submit" name="Submit"&gt;Submit&lt;/button> </form> What am I doing wrong?

Aug
21
1 month ago
Activity icon

Replied to Laravel 7 - Getting Count From A Pivot Table

This works. Just a minor update: // had ::: instead of :: if ($company = Auth::user()->company) { //has company } else { // doesnt have company }

Activity icon

Replied to Laravel 7 - Getting Count From A Pivot Table

No I haven't because I am not sure if you can query it for a single user. It seems to be more useful if I had employees and projects and then querying for employees without projects. For some reason I find Eloquent to be confusing. The previous app that i wrote in laravel 5.1 i had simply used DB with raw queries. Trying to do it more elegantly this time.

Would the code be then?

if ($company = App\User::doesntHave('companies')->get() ;) { do something }

else { do the other thing}

Activity icon

Started a new Conversation Laravel 7 - Getting Count From A Pivot Table

Use case: A user can have only 1 company. But a company can have many users. After logging in if the user is an admin and has already created a company then I want him to show a different landing page than the if he has not. I have tried various things including DB query but nothing is returning a county. Ideally I should be able to get the row count to 1 or 0 but I am not able to do so. This use case doesn't not apply to any non-admin users as they are not allowed to create a company. They are assigned a company just like a role is.

My pivot table is structured as follows:

users id - integer name - string

companies id - integer name - string

company_user user_id - integer company_id - integer

I also have two classes Company.php and User.php that comes with Laravel's Auth.

In the User.php - I have the following function:

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

In the Company.php I have the following:

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

Aug
20
1 month ago
Activity icon

Replied to Laravel 7 - How To Capture The Referral Source

How do implement these? Do they go in a controller or view?

Activity icon

Started a new Conversation Laravel 7 - How To Capture The Referral Source

Hi, I need to capture the referral source and store it in my database when the user signs up for a waitlist. A use case can be www.mysite.com/?source=abc www.mysite.com/?source=123. www.mysite.com/?source=xyz and I would like to store abc, 123, xyz based on the link user used to enter my website.

I tried the following tactics:

  1. $referer = request()->headers->get('referer'); echo $referer;

Result: No output when used inside a controller and just prints the code above when used in a view

  1. https://github.com/spatie/laravel-referer

Bunch of errors. Doesn't work on the L7. I think mainly because the documentation is poor for this package compared to other Spatie packages.

Aug
18
1 month ago
Activity icon

Replied to Does Laravel Cashier Use Stripe Billing API

No worries. English is my second language. I may have not been able to explain it well. Thank you for all your help.

Activity icon

Replied to Does Laravel Cashier Use Stripe Billing API

Thanks - this is the answer I was looking for. In my case it is going to be a small business payments engine but with multiple tenants on the platforms. I handle payments on a tenant's behalf and also charge my tenant a monthly subscription fee. I may eventually expand the payment process on tenant's behalf to other methods such as Paypal. Therefore some flexibility is required. Are you using any packages to manage subscriptions as well as Stripe Connect? I want to build a very flexible solution so that I am not married to a single payment company.

Activity icon

Replied to Does Laravel Cashier Use Stripe Billing API

OK let me see if I can clarify. Cashier has an integration with stripe. The question is when Cashier makes payment call does it hit Stripe's payments API or Stripe's Billing API. Cost is different for both. My need is a hybrid of both. I need to bill my business customers using a subscription plan but I need to also process one time payments for their customers. Think of it as a market place. Where sellers are paying me the platform host a monthly fee to be on the market place. But when their customers buy some something that is a one time charge.

The reason I had put the billing link was to show that if the Billing API is used then there are extra charges on top of 2.9% + $0.30. Where as if only the Payments API is used it is only 2.9% + $0.30.

Link to stripe API - https://stripe.com/docs/api

It has both Payments and Billing APIs.

Activity icon

Replied to Does Laravel Cashier Use Stripe Billing API

I know that too. The question is not whether they charge or not. Please read the question again.

Activity icon

Started a new Conversation Does Laravel Cashier Use Stripe Billing API

Does Laravel cashier use Stripe's billing API? Or does it create its own subscription schedules? The reason I am asking this is because I went to Stripe's Billing API website and noticed that they have extra charges for it. Can someone please advise?

https://stripe.com/billing/pricing

Aug
16
1 month ago
Activity icon

Started a new Conversation AdminLite CSS Integration Into My Custom CSS

Is there a way to integrate the AdminLite css into my own custom theme without breaking AdminLite. I tried several ways including using CSS from both themes but things get broken. I am using the custom theme for my Landing page and for branding purposes I would like the look and feel to be the same. I am using blade templates in Laravel 7

Aug
08
1 month ago
Activity icon

Started a new Conversation Laravel Dynamic Subdomain With Tenancy

I am looking at Tenancy - https://tenancy.dev/

to build a multi-tenant application with its own subdomain (e.g. abcinc.mysite.com) . But it seems like to support each new tenant i will have to manually create a subdomain. Is there a way to automate that process with Laravel?

Aug
06
1 month ago
Activity icon

Started a new Conversation UI Kit To Connect Components For Workflow Management

I am trying to create a web based workflow management software and looking for a UI Kit. It will be very similar to the Sketch app (no not another UX design package) where you can drag and drop components and then connect them with directional wires/arrows. Any suggestions? I am planning to use Laravel to create it.

Aug
03
1 month ago
Activity icon

Awarded Best Reply on Laravel 7 - Customizing App Layout With A Custom Template

figured out. there was an issue with the theme i bought. thanks.

Activity icon

Replied to Laravel 7 - Customizing App Layout With A Custom Template

figured out. there was an issue with the theme i bought. thanks.

Activity icon

Started a new Conversation Laravel 7 - Customizing App Layout With A Custom Template

I am trying to customize app.blade.php in the layouts with a custom html template i have. For my welcome view i have a three files in the shared folder called header.blade.php, body.blade.php and footer.blade.php and it renders fine. However, for the app layout that is used by Auth all i see is my preloader javascript running. Even if i disable it my navigation bar shows up clear and the only thing I can see is my custom Login button that is green in color. I tried using the my files from the shared folder in both the layouts and auth folders but neithe worked. Any tips?

Jul
26
2 months ago
Activity icon

Replied to Managing Multiple Mail Chimp Accounts From A Single Laravel Instance

But doesn’t the mail chimp package look at the config file for an API key? I am confused how can I do it otherwise. Do you have an example somewhere?

Jul
25
2 months ago
Activity icon

Replied to Managing Multiple Mail Chimp Accounts From A Single Laravel Instance

This might work:

Per https://laravel.com/docs/7.x/configuration

to set a configuration in the run time -

config(['app.timezone' => 'America/Chicago']);

Instead use:

config(['app.mailchimpkey => $mailchimpkey]);

Activity icon

Replied to Putting .ENV Variables Into A Database Table?

@thc1967 were you able to resolve this? I have a similar issue where I am trying to build a way to read api keys for multiple instances of a third party service. I am ok with keeping my db credentials in the .env but need everything else driven by a db.

Activity icon

Replied to Managing Multiple Mail Chimp Accounts From A Single Laravel Instance

How do fetch them from database? I have gone through some articles but haven't been able to find anything solid pointing me on how to get the information from database for a config parameter.

Activity icon

Started a new Conversation Managing Multiple Mail Chimp Accounts From A Single Laravel Instance

My company has 6 different mail chimp accounts due to various acquisitions and mergers. The marketing VP doesn't want reduce them to one account. Instead he is looking to have one interface for multiple accounts. Is that something we can achieve with Laravel? Mailchimp has an integration with laravel and I can see that it can easily support an integration with 1 account. How do I go about 6 accounts? The VP is ok with having 6 different logins for the console if needed. The ideal situation would be to drive the Mailchimp config variable from the database than the .env file. Any suggestions would be great.

Activity icon

Replied to How To Generate An HTML Snipped That Can Be Copied?

I was able to successfully do it with Cliboardjs

Jul
23
2 months ago
Activity icon

Started a new Conversation How To Generate An HTML Snipped That Can Be Copied?

I am trying to create an HTML snipped that a site visitor can copy and paste in their email signature. Below is an example use case:

  1. User submits their name, title, company, address, email and company website in a form.
  2. This information is show in a Form like box but in HTML syntax that they can copy and paste in their email or even their website. For example, for the company website it shows <a href tag along with the URL. and <h4 tag for user's name.

A good example would be copying Google Analytics javascript code that can be embedded in a webpage footer.

Are there any packages available for this?