NOMGUY

Member Since 7 Months Ago

Chandigarh

Laravel Developer at Uimatic

Experience Points 65,770
Experience Level 14

4,230 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 575
Lessons
Completed
Best Reply Awards 8
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

15 Mar
5 days ago

NOMGUY started a new conversation Laravel 5.7 Files Merge

I have uploaded 3 types of files. PDF, Word, JPG. Is there a way or package so that when I click download button, the downloaded file gives me a "Merged" file of all the three types. I mean, one pdf file is downloaded which contains all my three types of file (PDF, Word and JPG).

05 Mar
2 weeks ago

NOMGUY left a reply on How To Fill Db With Id Of A Value From Textbox Laravel

You need to create a Seed for that so that you can declare the things related to the id's.

<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class SecretarySectionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        DB::table('secretary_sections')->truncate();
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');

        $faker = Faker\Factory::create();

        if (DB::table('secretary_sections')->where('tag', 'client-notes')->count()==0) {
            /* Client Notes */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.client_notes'),
                'title'             =>  'Client Notes',
                'tag'               =>  'client-notes',
                'commenting'        =>  true,
                'type'              =>  'PUBLIC',
                'section_type'      =>  'NOTE',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'offering-notes')->count()==0) {
            /* Offering Notes */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.offering_notes'),
                'title'             =>  'Offering Notes',
                'tag'               =>  'offering-notes',
                'commenting'        =>  true,
                'type'              =>  'PUBLIC',
                'section_type'      =>  'NOTE',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'required-documents')->count()==0) {
            /* Required Documents */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.required_documents'),
                'title'             =>  'Required Documents',
                'tag'               =>  'required-documents',
                'commenting'        =>  true,
                'type'              =>  'PUBLIC',
                'section_type'      =>  'DOCUMENT',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true,
                'process_fdf'       =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'marketing-material')->count()==0) {
            /* Marketing Material */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.marketing_material'),
                'title'             =>  'Approved Marketing Material',
                'tag'               =>  'marketing-material',
                'commenting'        =>  true,
                'type'              =>  'PUBLIC',
                'section_type'      =>  'DOCUMENT',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'transaction-notes')->count()==0) {
            /* Transaction Notes */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.transaction_notes'),
                'title'             =>  'Notes',
                'tag'               =>  'transaction-notes',
                'type'              =>  'PUBLIC',
                'section_type'      =>  'NOTE',
                'allow_deletion'    =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'transaction-documents')->count()==0) {
            /* Transaction Documents */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.transaction_documents'),
                'title'             =>  'Transaction Documents',
                'tag'               =>  'transaction-documents',
                'type'              =>  'PUBLIC',
                'section_type'      =>  'DOCUMENT',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true,
                'flatten_uploads'   =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'investor-offering-updates')->count()==0) {
            /* Offering Updates */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.investor_offering_updates'),
                'title'             =>  'Offering Updates',
                'tag'               =>  'investor-offering-updates',
                'commenting'        =>  true,
                'type'              =>  'PUBLIC',
                'section_type'      =>  'DOCUMENT',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'emd-notes')->count()==0) {
            /* EMD Notes */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.emd_notes'),
                'title'             =>  'EMD Notes',
                'tag'               =>  'emd-notes',
                'type'              =>  'PUBLIC',
                'section_type'      =>  'NOTE',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'advisor-notes')->count()==0) {
            /* Advisor Notes */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.advisor_notes'),
                'title'             =>  'Notes',
                'tag'               =>  'advisor-notes',
                'type'              =>  'PUBLIC',
                'section_type'      =>  'NOTE',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'advisor-documents')->count()==0) {
            /* Advisor Documents */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.advisor_documents'),
                'title'             =>  'Documents',
                'tag'               =>  'advisor-documents',
                'type'              =>  'PUBLIC',
                'section_type'      =>  'DOCUMENT',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'client-documents')->count()==0) {
            /* Client Documents */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.client_documents'),
                'title'             =>  'Active Documents',
                'tag'               =>  'client-documents',
                'type'              =>  'PUBLIC',
                'section_type'      =>  'DOCUMENT',
                'allow_attachments' =>  true,
                'allow_deletion'    =>  true,
                'allow_signatures'  =>  true,
                'flatten_uploads'   =>  true,
                'process_fdf'       =>  true
            ]);
        }

        if (DB::table('secretary_sections')->where('tag', 'help-request')->count()==0) {
            /* Help Request / Request Tracker */
            DB::table('secretary_sections')->insert([
                'id'                =>  config('secretary.section_map.request_tracker'),
                'title'             =>  'Help Request',
                'tag'               =>  'help-request',
                'type'              =>  'PUBLIC',
                'section_type'      =>  'NOTE',
                'allow_deletion'    =>  true,
                'allow_tasks'       =>  true,
                'requires_approval' =>  true
            ]);
        }
    }
}

Note: Please ignore the value of 'id', you can manually pass the id. For ex: id => 3 run the seed command. All the data would be seeded. You can see the table https://prnt.sc/mtgrb0

04 Mar
2 weeks ago

NOMGUY started a new conversation 5.7 Laravel Normal Question

Is Laravel 5.7 stable now? What are the advantages/disadvantages/new features of 5.7 update?

NOMGUY left a reply on Pass The Checkbox Id Phpclass In Laravel

You can try:

$('.classid').click(function(){

  var data = {
    classid: $(this).val();
};


  $.ajax({
                        headers: {
                                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                                },
                                    type: 'GET',
                                    dataType: "json",
                                    url:"/classid/ajax",
                                    data: data,
                                    success: function (resultData) {
   
                                    }
                });

NOMGUY left a reply on If Something Exists In A Table

Hello @shiva Could you please elaborate on your problem specifically. As it is not clear what you want to know from us.

NOMGUY left a reply on 419 Error Caused By Token Mistmatch.

Hello @stubbs I faced the same issue as-of yours two days ago. I can fix it. Just go to "/var/www/html/Incapsol2/app/Http/Middleware/VerifyCsrfToken.php" change:

protected $except = [
    "/*"
];

That's it. Note: It could remove csrf token check for all of the routes.

Ideally, if you don't want the csrf check to be removed from all of the urls, you can simply declare the url that is causing the problem in the same array. Fro an instance:

protected $except = [
        'note/*',
        'note/*/media/*',
        'logout',
        'section/*/note',
        '/report/distributions/datatables',
        '/report/distributions/datatables/commissions',
        '/report/distributions/datatables/export',
        '/report/distributions/datatables/distribution',
        '/report/distributions/datatables/issuer',
        '/report/distributions/datatables/exports/report',
        '/report/transaction/commission-summary/datatable',
        '/report/distributions/datatables/balance',
        '/report/distributions/datatables/activity'
    ];

NOMGUY left a reply on Error In Yajra Data Table Installation Your Requirements Could Not Be Resolved To An Installable Set Of Packages.

Hello @gurvindersingh Your Laravel version doesn't seems to be compatible with yajra-datatable version. As your Laravel version is 5.44, you need to install yajra-datatable with version 8.0. If you wish to install yajra-datatable version 9.0, then you need to upgrade your Laravel to 5.8.

11 Feb
1 month ago

NOMGUY left a reply on Restore Function Return 404 Not Found

It's going to work @ch

NOMGUY left a reply on Restore Function Return 404 Not Found

Do it like this. It will work for you.

public function restore($post_id)
    {
    Post::withTrashed()->find($post_id)->restore();
        alert()->success('post has been restore')->persistent('Ok');
        return redirect('/blog/post?status=trash');
    }

NOMGUY left a reply on Restore Function Return 404 Not Found

yes because it needs an 'id' to restore. Until or unless you pass an id to specify a post, it will show that error again and again.

NOMGUY left a reply on Restore Function Return 404 Not Found

Or else you can print the request too. to know the data

public function restore(Request $request, $post_id)
    {
echo '<pre>';
print_r($request->all());
die;
    $post = Post::find($post_id);
        $post->onlyTrashed()->restore();
        alert()->success('post has been restore')->persistent('Ok');
        return redirect('/blog/post?status=trash');
    }

NOMGUY left a reply on Restore Function Return 404 Not Found

Your code has to be like:

{!! Form::open(['style' => 'display:inline-block','method' => 'PUT', 'route' => ['post.restore', $post->id]])!!}
      <button title="Restore Post" type="submit" class="btn btn-xs btn-default">
           <i class="fa fa-refresh"></i>
      </button>
{!! Form::close() !!}
Route::post('/blog/post/{post_id}/restore',[
    'uses' => 'Backend\[email protected]',
    'as' => 'post.restore'
]);
public function restore($post_id)
    {
    $post = Post::find($post_id);
        $post->onlyTrashed()->restore();
        alert()->success('post has been restore')->persistent('Ok');
        return redirect('/blog/post?status=trash');
    }

NOMGUY left a reply on Restore Function Return 404 Not Found

you need to pass the id of the post so that it could pick that one only..

NOMGUY left a reply on How To Test A Redirect For Ressource Route

we use 'prefix' and for authenticity we use 'middleware' if you know what i mean

NOMGUY left a reply on Restore Function Return 404 Not Found

Route::post('/blog/post/{post}/restore',[
    'uses' => 'Backend\[email protected]',
    'as' => 'post.restore'
]);
09 Dec
3 months ago

NOMGUY left a reply on Laravel-paperclip

Here's your code for the model part:

public function __construct(array $attributes = [])
    {
        $this->hasAttachedFile('image', [
            'styles' => [
                'medium' => '300x300',
                'thumb' => '100x100'
            ]
        ]);
        parent::__construct($attributes);   
    }

NOMGUY left a reply on How To Apply Security Updates

I believe composer update is the command then you just need to clear your cache with php artisan cache:clear `` and php artisan cache:clear and finally run composer dump-autoload ```.

NOMGUY left a reply on Admin Check

Hey @alexzury ! How about something like:

public function isAdmin()
    {
        foreach ($this->roles()->get() as $role){
            if ($role->id == 2){
                return true;
            }
        }
        return false;
    }
04 Dec
3 months ago

NOMGUY started a new conversation GIT MERGE UNMERGE

I have a main branch named "testing". I created a new branch from it named "feature" and worked on it. After sometime I committed my changes into it and then merged it to "testing".

Then I created a new branch from "testing" after the merge named "bugs". I again worked on it and committed my work. And finally merged into "testing".

Now I want my code and work done in "feature" branch to get separated and work of "bugs" branch to be separated.

I guess I made my point. I just want my code to be specific irrespective of other branches.

I mean, if I want my code of "feature" branch then I want code of "feature branch only, not of newly updated code pushed in "testing" and not the code of "bugs" branch.

Thanks in advance.

25 Sep
5 months ago

NOMGUY left a reply on Difference Between !== & !=

In != we check is it "not equal to" example: 2 !=4 .. it will give true. and in !== we check for value as well as type. example: 2 !== 4 .. it will give true. but a !== 2 it will give false as "a" is a string and 2 is an integer.

17 Sep
6 months ago

NOMGUY left a reply on Validation Under Array Validation

In your controller you can create a Validator like:

protected function validator(array $data)
    {
        return Validator::make($data, [
            'email' => 'required|string|email|max:255|unique:users',
        ]);
    }

then in your create function, you can create it like:

protected function create(array $data)
    {
        $variable_name = Model_name::create([
            'email'    => $data['email'],
        ]);
        return view('your.view')->with('variable_name', $variable_name);
    }

NOMGUY left a reply on Npm Install Giving Warnings

No, it won't cause any future errors @rajcoder . If you're using linux system, try it using

sudo npm install else it is just fine.

NOMGUY left a reply on Validation Under Array Validation

$this->validate($request, [
    'email.*' => 'required|string|email|max:255',
]);
13 Sep
6 months ago

NOMGUY left a reply on One To Many / Many To Many Relationship

You can do it like:

public function rows() {
        return $this->hasMany('Models\Rows', 'row_id', 'id');
    }

Alternatively for every model too. after that you can do it like this in your controller:

$rows   = PageModel::with(['rows','components'])->get();

NOMGUY left a reply on Pass Variables From Controller To View

inyour controller, make your return like:

 return view('about')->with('variable_name', $variable_name);

and you can have multiple with statements to pass multiple variables like:

return view('about')->with('variable_name1', $variable_name1)
                     ->with('variable_name2', $variable_name2)
                     ->with('variable_name3', $variable_name3);

NOMGUY left a reply on How To Solve It

What problem are you getting with this? @fam

NOMGUY left a reply on How To Solve It

@fam Your form goes like:

 {!! Form::open( ['method' => 'POST', 'route' => 'posts.store'] ) !!}
       <input type="text" name="title" placeholder="Enter">
       <input type="submit" name="submit">
   {!!Form:close()!!}

and route goes like:

Route::group(['middleware'=>['web']],function(){
    Route::resource('/post', 'PostsController');
});

NOMGUY left a reply on Setting A Value For Global Variable In View That Can Be Used In Controller Laravel 5.5

you can set it like:

<a href="{{ route('campus.show', $campus->id) }}" class="btn">Campus Button</a>

then in your CampusController.php

public function show($id){
    $campus = Campus::find($id);
    return view(campus.index)->with('campus', $campus);
}

@mtdchavez

NOMGUY left a reply on Laravel Not Working With MSSQL

The problem's with your .env file. You need to specify the database name password and host.

NOMGUY left a reply on Strange Results Using Find() And Where()

And in the second case of your question, you're matching your id using where clause. @Penaf

NOMGUY left a reply on Strange Results Using Find() And Where()

In this case,

public function editar($id)
    {
        $documento = Documento::find($id)->with(['autor'])->first();
    return $document;
    }

it'll surely return the document with id 1 as your are finding it with find() but specifying to show the first document with first(). To make it work for id 3, you should type it like:

public function editar($id)
    {
        $documento = Documento::find($id)->with(['autor']);
    return $document;
    }

OR

public function editar($id)
    {
        $documento = Documento::find($id)->with(['autor'])->get();
    return $document;
    }
11 Sep
6 months ago

NOMGUY left a reply on Select Input Check Witch Option Is Selected

You can specify the default value for the option in the database itself.

NOMGUY left a reply on Query Is Takes Only First Id

instead of

return $query;

try

echo "<pre>";
print_r($query);
die;

for getting the products

NOMGUY left a reply on Display Total Number Of Rows

The View or page you would like it to be shown on. For ex: I want to show the total no. of images in my Albums table. Then I would do it on index page of album as

count($album->images);

I hope you're getting it...

NOMGUY left a reply on Display Total Number Of Rows

how about,

count($query_name);

NOMGUY left a reply on Query Is Takes Only First Id

Then do it,

$productIds = [1,2,3,5,6,8];

After that,

->whereIn('gp_products.product_id', $productIds)

NOMGUY left a reply on Query Is Takes Only First Id

Do it,

->orderByRaw('gp_products.position - gp_products.updated_at', 'DESC')
06 Sep
6 months ago

NOMGUY left a reply on Class 'socailuni\Http\Controllers\Controller' Not Found

Go to your UsersController and paste this as it is before class...

use socailuni\Http\Controllers\Controller;

NOMGUY left a reply on Class 'socailuni\Http\Controllers\Controller' Not Found

Do you have your controllers at this path or is it at

app/Http/Controllers

NOMGUY left a reply on Form Validation Not Work

Oops! Do mention

App\Http\Requests;

above. @sanjayacloud

NOMGUY started a new conversation PDO Session Handler

Where are the PDOSessionHandler store sessions?

NOMGUY left a reply on Form Validation Not Work

Try

$validation = $this->validate($request->all(),[
           'role'=> 'required',
        ]);

@sanjayacloud

05 Sep
6 months ago

NOMGUY left a reply on Error While Verify User And Login

There's an update in Laravel 5.7. How about giving it a read https://laravel.com/docs/5.7 OR see this https://laracasts.com/series/whats-new-in-laravel-5-7/episodes/1

NOMGUY left a reply on Updating Value In Database On Button Click

Did you create any route? @scala

NOMGUY left a reply on Desperate: Model Relationship Problem? SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column

In show.blade.php, Either do:

{{Form::open(['route' => ['notes.store', $forms->form_id], 'method' => 'POST']) }}

or do

{{Form::open(['route' => ['notes.store', $form_id], 'method' => 'POST']) }}