NOMGUY

Developer at Uimatic

Member Since 1 Year Ago

Chandigarh

Experience Points
68,560
Total
Experience

1,440 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
583
Lessons
Completed
Best Reply Awards
10
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.

Level 14
68,560 XP
05 Sep
2 weeks ago

NOMGUY left a reply on How Can I Stop Form Re-submitting After Clicking Browser Reload

Some code would be nice to start with. :)

09 Jul
2 months ago

NOMGUY left a reply on Fetch V-tab Anchor Class

I have got it:

console.log(document.getElementById('profile').getElementsByTagName('a')[0]);

NOMGUY started a new conversation Fetch V-tab Anchor Class

I have this code:

<v-tab ripple id="profile">
      <span class="tab-heading">Profile</span>
</v-tab>

and this mounted code:

mounted() {
     console.log(document.getElementById('profile'));
},

and I am getting this as output:

<div class="v-tabs__div" id="profile">
    <a class="v-tabs__item v-tabs__item--active">
        <span class="tab-heading">Profile</span>
    </a>
</div>

How can I fetch the anchor tag so that I can change it's active class.

04 Jul
2 months ago

NOMGUY left a reply on SSH Key Laravel

It worked!!! @snapey Thank you so much

NOMGUY left a reply on SSH Key Laravel

@snapey Checking..

NOMGUY started a new conversation SSH Key Laravel

I have installed this package for generating SSH Keys: https://github.com/codeaken/sshkey

But there doesn't seems to be any info regarding service provider and class name... Anybody who faced the same issue or can help me out?

02 Jul
2 months ago

NOMGUY left a reply on Editing Uploaded PDF Documents, Converting To HTML

@theunforgiven I too tried to convert pdf to html. It showed data the same way you are mentioning. and like @snapey said, pdf's are not designed to be dismantled.

NOMGUY left a reply on Showing Notification After Login

@nogepog Add a new column to the notifications table named "view_status" with bool datatype. Whenever you push a notification in your notifications table, set "view_status" to 0. Show notifications in the dialog box which has "view_status" set to 0. Add a button below dialog box(if necessary) so that whenever the button is cluicked it means the user have read the notification and into UserController, hit a route to that button where you update the "view_status" of the notification from 0 to 1.

Sample code for Notification view status update:

public function index()
{
     Notification::where('user_id', Auth::id())
     ->where('view_status', 0)
     ->update(['view_status'=> 1]);

     $notifications = Notification::where('user_id', Auth::id())
     ->orderBy('id', 'desc')
     ->paginate(50);

     return view('notifications', ['notifications' => $notifications ]); 
}
20 Jun
3 months ago
19 Jun
3 months ago

NOMGUY left a reply on "This Site Can’t Be Reached"

@deansatch Dude, I got it. I didn't fixed switching the browsers. The problem was, that I was missing some data. I mean I was writing some data in the csv file which was coming blank(make sure data is fetching properly and put checks of isset and not null wherever necessary). That's why it showed me that. Thanks by the way. Cheers!

NOMGUY left a reply on "This Site Can’t Be Reached"

@deansatch Okay cool. Let me try on FF. Will get back soon.

NOMGUY left a reply on "This Site Can’t Be Reached"

@deansatch I mentioned, I am running it locally and if I go to investors link which it like:

localhost:4000/investors

and the download button is:

localhost:4000/investors/export

It just easily downloads the data for investors. But for issuers, it is showing that error. I have the exact urls for issuers too like

localhost:4000/issuers
// and
localhost:4000/issuers/export

When i try to dd in that function of issuers, it does gives me output. But... If you know what I mean.

NOMGUY left a reply on "This Site Can’t Be Reached"

@deansatch Yes, I am running this project locally. And the functions are not identical. You see, in first function, I am fetching data related to an "Investor" and running foreach on it and similarly, in second function, I am fetching data related to an "Issuer".

NOMGUY left a reply on "Class 'App\Http\Controllers\FetchPostsfromBlog' Not Found"

@domegang Isn't it a heads up? It'll help me get some experience with my profile. Only if you wish. No problem by the way.

NOMGUY started a new conversation "This Site Can’t Be Reached"

I am having some issues downloading my csv file. I have two controllers. The first one is like:

public function exportInvestorData(Request $request)
    {
        $coll = Investor::all();

        header("Content-type: application/csv");
        header("Content-Disposition: attachment; filename=investors.csv");
        $fp = fopen('php://output', 'w');
        $addkeys=true;
        foreach ($coll->get() as $investor) {
            $data = [
                    // my data
            ];

            if ($addkeys) {
                fputcsv($fp, array_keys($data), ',');
                $addkeys=false;
            }
            fputcsv($fp, array_values($data));
        }
        fclose($fp);
        exit;
    }

It works absolutely fine. It generates the csv file with all data. But i have the similar code in the other controller like:

public function exportIssuerData(Request $request)
    {
        $coll = Issuer::all();

        header("Content-type: application/csv");
        header("Content-Disposition: attachment; filename=issers_offerings.csv");
        $fp = fopen('php://output', 'w');
        $addkeys=true;
        foreach($coll->get() as $issuer) {
            $data = [
                    // my data
            ];

            if($addkeys) {
                fputcsv($fp, array_keys($data), ',');
                $addkeys=false;
            }
            fputcsv($fp, array_values($data));
        }
        fclose($fp);
        exit;
    }

When I try to download the csv, it says: https://prnt.sc/o3pkkp

12 Jun
3 months ago

NOMGUY left a reply on All Of A Sudden "Invalid Environment Key"

@ovthomas I guess if I am right, then you should try the following command in your terminal or command line:

php artisan key:generate
31 May
3 months ago

NOMGUY left a reply on Non-static Method Illuminate\Http\Request::ip()

@salomon022 You could do it like:

function ipShow()
{
   $ip = $this->_getClientIp();
   return $ip;
}

NOMGUY left a reply on Laravel Scheduler - No Scheduled Commands Are Ready To Run

@ajdk2 Try it like:

$schedule->call(function () {
            dd('hello world');
        })->everyMinute()->withoutOverlapping();

and agter that run:

composer dump-autoload

and finally

php artisan schedule:run
30 May
3 months ago

NOMGUY left a reply on Validation

What my code will do is it will show the error under the input fields you made. So, suppose you are putting a wrong email and after that pressing submit button, below input field there would be an error like "You entered a wrong email.". If you define so. @chron

29 May
3 months ago

NOMGUY left a reply on Validation

@chron Have you tried:

$rules = [
    'something1' => 'required',
    'something2' => 'required',
    'something3' => 'required'
];

$messages = [
    'something1.required' => 'This field is required',
    'something2.required' => 'This field is required',
    'something3.required' => 'This field is required',
];

$validator = Validator::make($request->all(), $rules, $messages);

if($validator->fails()) {
    return Response::json([
        'status' => false,
    ]);
} else {
    // your queries
}

NOMGUY left a reply on "Class 'App\Http\Controllers\FetchPostsfromBlog' Not Found"

@domegang It took me a bit to get this, but I think you are missing a capital "F" in the "use". see it here.. you are writing it like:

use App\Http\Controllers\FetchPostsfromBlog;

but it has to be:

use App\Http\Controllers\FetchPostsFromBlog;

you see capital "F" of "From"

28 May
3 months ago

NOMGUY left a reply on Not Working File Attachment With Laravel 5.7

@msoft The request seems to be working fine. Please try:

dd($request->file('file')->getClientOriginalName());

If that gives you file name then the code should be:

public function store(Request $request)
{
    if($request->file('file')) {
        $newFilename = 'demo-file_'.Carbon::now()->format('Y-m-d-H-i-s').'.pdf';
        $uploadedFile = $request->file('file')->getRealPath();

        Storage::disk('local')->put($newFilename, file_get_contents($uploadedFile));
    }
        $datas = New Data();
        $datas->job = $request->input('job');
        $datas->name = $request->input('name');
        $datas->expe = $request->input('exp');
        $datas->salary = $request->input('salary');
        $datas->file = ($request->file('file')) ? $request->file('file')->getClientOriginalName() : ' ';
        $datas->save();

        return redirect()->back()->with('info','Your Job has been saved sucessfully');
}

NOMGUY left a reply on Not Working File Attachment With Laravel 5.7

@msoft one last favour, can you please print:

echo '<pre>';
print_r($request->all());
die;

and show me the output. That would be helpful.

NOMGUY left a reply on How To Send Name For Subject_id From Subject Table In Laravel?

@raviawasti Please write it properly. I get nothing out of it.

NOMGUY left a reply on Not Working File Attachment With Laravel 5.7

@msoft The final code shows up like this:

public function store(Request $request)
{
        $datas = New Data();
        $datas->job = $request->input('job');
        $datas->name = $request->input('name');
        $datas->expe = $request->input('exp');
        $datas->salary = $request->input('salary');
        $datas->file = $request->file('file')->getClientOriginalName();
        $datas->save();

        return redirect()->back()->with('info','Your Job has been saved sucessfully');
}

NOMGUY left a reply on Not Working File Attachment With Laravel 5.7

@msoft Still this gave you an error:

$datas->file = $request->file('file')->getClientOriginalName();

? I am assuming that may be you are getting errors because of

$datas = New Data;

I think this should be:

$datas = New Data();

Any thoughts on this one?

NOMGUY left a reply on How To Write My Own Code For Each Field Validation?

@nekooee Why can't you just write it like:

$rules = [
    'something1' => 'required',
    'something2' => 'required',
    'something3' => 'required'
];

$messages = [
    'something1.required' => 'This field is required',
    'something2.required' => 'This field is required',
    'something3.required' => 'This field is required',
];

$validator = Validator::make($request->all(), $rules, $messages);

if($validator->fails()) {
    return Response::json([
        'status' => false,
    ]);
} else {
    // your queries
}

NOMGUY left a reply on Update With CRUD

@wuschelino22 please run

php artisan route::list

in the terminal and share the output.

NOMGUY left a reply on Remove All Sessions Apart From Current Laravel

@nizam0786 How about trying:

Session::flush()->except(auth()->id())

NOMGUY left a reply on How To Update Call Session

@irankhosravi You may try:

Session::all();

Reference: https://laravel.com/docs/5.0/session

NOMGUY left a reply on Not Working File Attachment With Laravel 5.7

@msoft Please share the output for

echo '<pre>';
print_r($request->file('file'));
die;

write this in starting of "store" function

14 May
4 months ago

NOMGUY left a reply on How To Store Upload An Image?

Hey @irankhosravi . What's the problem. Referring to: @NOMGUY - I look at this video already but I have a problem

13 May
4 months ago

NOMGUY left a reply on 'Method Does Not Exist' When Using WhereMonth()

@miHow about writing it like:

$files->whereMonth('created_at', Carbon::parse($month)->format('m'))

NOMGUY left a reply on Multiple Orwheres Wont Work

Yes, it won't work until you mention the table name in where query. Like:

$joinindicators = DB::table('indicators')
       ->join('financial_categories', 'financial_categories.id', '=', 'indicators.financial_id')
       ->join('strategy_categories', 'strategy_categories.id', '=', 'indicators.strat_id')
       ->join('time_frame_categories', 'time_frame_categories.id', '=', 'indicators.timeframe_id')
       ->select('indicators.*', 'financial_categories.financial_type', 'strategy_categories.strategy','time_frame_categories.timeframe')
       
       ->where('financial_categories.financial_id', '=',request('fin'))
->orwhere('time_frame_categories.strat_id', '=',request('strat'))
        ->orwhere('indicators.indicator_name', 'like','%' .request('s'). '%')
      ->orWhere('Description', 'like','%' .request('s'). '%')

or what so ever table has those columns.. you need to pass it like mentioned wbove.. just observe "where" and "orwhere" conditions

09 May
4 months ago

NOMGUY started a new conversation Merge Same Array

I have two arrays within an array:

Array
(
    [0] => Array
        (
    [id] => 1
            [advisors] => Array
                (
                    [0] => Array
                        (
                            [first_name] => Johns
                            [last_name] => rep_last0
                        )

                    [1] => Array
                        (
                            [first_name] => Janes
                            [last_name] => rep_last1
                        )
                )
        )
     [0] => Array
        (
        [id] => 2
            [advisors] => Array
                (
                    [0] => Array
                        (
                            [first_name] => test
                            [last_name] => user
                        )
                )
        )
)

What I want it.. it should show something like this.

Array
(
    [0] => Array
        (
            [advisors_name] => Johns rep_last0, Janes rep_last1
        )
     [0] => Array
        (
            [advisors_name] => test user
        )
)

How can I do that?

21 Apr
4 months ago

NOMGUY left a reply on My Ajax Keep Returning 419 And 500 Error Status

put your full url in VerifyCsrfToken.php 's $except array.. for ex: if ypu have your url like

localhost:8000/dashboard/albums/image 

then put 'dashboard/albums/image' in $except array.. it'll not throw 419 error.. but also it will not check for CSRF token.. I repeat, token verificatiom will be disabled for that url you put there

19 Apr
5 months ago

NOMGUY left a reply on Renaming A Column In SQLite On A Table Referenced By A Foreign Key Fails

Use it like this then:

public function up()
{
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        Schema::table('users', function (Blueprint $table) {
                $table->renameColumn('name', 'display_name');
         });
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
}

And don't forget to write

use DB;

at the top. @tylernathanreed

NOMGUY left a reply on Renaming A Column In SQLite On A Table Referenced By A Foreign Key Fails

How about writing the reverse of it in down() function:

Schema::table('users', function (Blueprint $table) {
     $table->renameColumn('display_name', 'name');
});
17 Apr
5 months ago

NOMGUY left a reply on After Adding Auth Middleware To My Routes Error 404

Yes, it will throw error becuase you are not using the correct syntax for "group". It has to be like:

Route::group(['middleware' => ['auth']], function () {
    Route::get('/', '[email protected]')->name('home');

Route::get('reports','[email protected]')->name('reports');
Route::get('report/detail/{id}','[email protected]')->name('report.detail');
Route::get('report/create','[email protected]')->name('report.create');
Route::post('report/store','[email protected]')->name('report.store');
Route::get('report/edit/{id}','[email protected]')->name('report.edit');
Route::post('report/update/{id}','[email protected]')->name('report.update');
Route::get('report/delete/{id}','[email protected]')->name('report.delete');

Route::get('document/create','[email protected]')->name('document.create');
Route::post('document/store','[email protected]')->name('document.store');
Route::get('document/detail/{id}','[email protected]')->name('document.detail');
Route::get('document/edit/{id}','[email protected]')->name('document.edit');
Route::post('report/update','[email protected]')->name('document.update');
Route::get('document/delete/{id}','[email protected]')->name('document.delete');

Route::get('/about-ofsd', '[email protected]')->name('about-ofsd');
Route::get('/about-project', '[email protected]')->name('about-project');
Route::get('/project-location', '[email protected]')->name('project-location');
}

NOMGUY left a reply on How To Arrays Into One Array ?

Hello @shoaibansari How about doing it like:

$res = array_merge($users, $songs);
$result = array_merge($res, $albums);

Reference: https://www.w3schools.com/php/func_array_merge.asp

01 Apr
5 months ago

NOMGUY started a new conversation Images Not Getting Displayed In PDF

Hello! I am using PHPWord for .docx to .pdf conversion. It is successfully converting the document to pdf but there's one issue. If the .docx file has any image in it's page, the .pdf file generated is not showing the image.

Here's the code for PHPWord:

        $domPdfPath = realpath(PHPWORD_BASE_DIR . '/../vendor/dompdf/dompdf');
        \PhpOffice\PhpWord\Settings::setPdfRendererPath($domPdfPath);
        \PhpOffice\PhpWord\Settings::setPdfRendererName('DomPDF');
        $phpWord = \PhpOffice\PhpWord\IOFactory::load($mergeFilePath); 
        $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'PDF');
        $objWriter->save($destinationPath);

PHP: 7.2.16 Laravel: 5.7 PHPWord: 0.16

26 Mar
5 months ago

NOMGUY left a reply on .doc/.docx To .pdf

Yeah, I saw that one. It's successfully converting .docx files to .pdf. Problem 1: It is not showing images in pdf Problem 2: It is not converting .doc to .pdf

Any help out there?

25 Mar
5 months ago

NOMGUY started a new conversation .doc/.docx To .pdf

Does anybody know a library which I can use to convert an realtime uploaded doc or docx file to pdf.

Thanks in advance for your help!