cviv

cviv

Member Since 2 Years Ago

Experience Points 13,870
Experience Level 3

1,130 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 40
Lessons
Completed
Best Reply Awards 12
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.

24 Jun
3 weeks ago

cviv left a reply on Salihawa

How did you install the package? Did you follow the procedures here

cviv left a reply on Error: Is Not A Function

How about

 $(document).on('click', '#save', function(){
        var post= $("#editor").html();
                $.ajax({
                    method: 'POST',
                    url: '/user/documents/{{$document->id}}/edit',
                    data: {
                        created_post: post,
                    },
                    success: function(response){ 
                        console.log(response);
                    },
                    error: function(jqXHR, textStatus, errorThrown){ 
                        console.log(JSON.stringify(jqXHR));
                        console.log("AJAX error: " + textStatus + + ' : ' + errorThrown);
                    }
                });
            })
23 Jun
3 weeks ago

cviv left a reply on Update Stock

$message= array();//place outside the loop
if($product->quantity - $item->qty<0);
$message[] = 'Not enough Product' . $item->id;
else
$product->update(['quantity' => $product->quantity - $item->qty]);

then return $message to your view

cviv left a reply on GroupBy Not Working

try this

$books= Books::orderBy('Year')
    ->get()
    ->groupBy(function ($val) {
        return Carbon::parse($val->Year)->format('Y');
    });

cviv left a reply on Error: Is Not A Function

did you try removing the quote on created_post?

cviv left a reply on Update Stock

you cannot return a redirect because you are in a loop. I guess you need to put your message in an array like: Product A added successfully, Product B failed, insufficent quantity

cviv left a reply on Update Stock

my bad. sorry, you must implement it here

if($product->quantity - $item->qty<0);
do you logic here
else
$product->update(['quantity' => $product->quantity - $item->qty]);

cviv left a reply on Update Stock

there is an error in your implementation, how do you check out your product? one at a time or by bulk quantity?

cviv left a reply on Update Stock

my suggestion is posted in the code

public function checkout(){



        if(Request::isMethod('post')){
            $product_id = Request::get('product_id');
            $product = Product::find($product_id);
            Cart::add(array('id' => $product_id, 'name' => $product->name, 'qty' => 1, 'price' => $product->price));
        }
        $cart = Cart::content();
        //increment
        if (Request::get('product_id') && (Request::get('increment')) == 1) //this can be if(Request::get('increment')) == 1)  < is it possible to submit a POST request without a product id? If so, please check your front-end logic> 
 {
            $item = Cart::search(
                function($key, $value) {
                    return $key->id == Request::get('product_id');
                })->first();
            Cart::update($item->rowId, $item->qty += 1);
        }
        if  (Request::get('decrease')) == 1) //check first if $item->qty >0. you might disable your button if quantity is 0
{
            $item = Cart::search(function($key, $value) { return $key->id == Request::get('product_id'); })->first();
            Cart::update($item->rowId, $item->qty -= 1); //

        }

cviv left a reply on Inquiry

you might want to check your browser settings.

cviv left a reply on Bug When I Manually Login Users

@chron If you login, this will be handled by

App\Http\Controllers\Auth\LoginController.php 

and if you noticed there isphp protected $redirectTo = '/dashboard'; This redirects you to your dashboard after logging in. But if you are already logged in, and tried to go to the log in page, this will be handled by, php App\Http\Middleware\RedirectIfAuthenticated

you must change this php return redirect('/home'); to the route you desired.

cviv left a reply on Bug When I Manually Login Users

@chron AFAIK if you get redirected to /home then you are authenticated/logged in.

04 May
2 years ago

cviv left a reply on Newbie! Having A Trouble To Get All The Information.

what have you done so far?

19 Apr
2 years ago

cviv left a reply on Logout In Laravel

try this or this

cviv left a reply on MethodNotAllowedHttpException In RouteCollection.php Line 218:

you are using die and dump.. it will not insert data in your db.

08 Apr
2 years ago

cviv left a reply on Npm WARN Deprecated [email protected]: Use Uuid Module Instead

Is this solved? I was scratching my head for weeks to find a solution.. using wampserver 64 did not solve mine. BUT I tried using laragon

after create a new laravel project

npm install

I had 3 warnings, I solved this using

npm install -g uuid
npm install -g [email protected]
npm install -g [email protected]

then

npm run dev

this time it worked. I hope this could help

26 Mar
2 years ago

cviv left a reply on Paginate Blog Example From "Laravel 5.4 From Scratch Series"

have you tried

$posts = $tag->posts()->paginate(5);

better try our query with tinker

cviv left a reply on How To Update IsApprove Value In Database Upon Clicking Approve Button?

ok.. if you click approved what is it suppose to show you? or do?

cviv left a reply on How To Update IsApprove Value In Database Upon Clicking Approve Button?

ok... try showing in your form the values of $tutor->id.. can you see it there?

cviv left a reply on How To Update IsApprove Value In Database Upon Clicking Approve Button?

Your route uses patch

Route::patch('/tutors/update/{id}', ['as' => 'admin.tutors.update', 'uses' => 'Admin\[email protected]']);

while you form uses PUT.. try to change it.

cviv left a reply on How To Update IsApprove Value In Database Upon Clicking Approve Button?

Where did you get $tutor->id? only user.id is in your pendingtutors_table.

cviv left a reply on How To Update IsApprove Value In Database Upon Clicking Approve Button?

 {!! Form::open(['method' => 'PATCH', 'route' => ['admin.tutors.update', $tutor->id], 'style'=>'display: inline-block']) !!}
{!! Form::hidden('isApproved', '1') !!}
{!! Form::submit('Approve') !!}

{!!Form::close()!!}

cviv left a reply on How To Update IsApprove Value In Database Upon Clicking Approve Button?

my bad.. forgot you have the same controller for approved and denied.. can you do

$tutor->isApproved =$request->Input::get('isApproved');
dd($$tutor->isApproved);

what is the value?

cviv left a reply on How To Update IsApprove Value In Database Upon Clicking Approve Button?

public function update($id, TutorRequest $request){

    $tutor = Tutor::findorfail($id);
   $tutor->isApproved =1;
//or $tutor->isApproved ='1'; if string
    $tutor->save();

 return redirect()->route('admin.courses');
    }

cviv left a reply on Two Questions (pasting Code, Making My Own Route , The Php Practitioner)

A1. Use Markdown with GitHub-flavored code blocks.

A2. check your .htaccess file

23 Mar
2 years ago

cviv left a reply on Routes Doesn't Work With Virtual Host In Xampp

Yes.. It means that index is not defined in your routes.. And make sure you have about.blade.php

cviv left a reply on Routes Doesn't Work With Virtual Host In Xampp

Did try to change the route?

cviv left a reply on Routes Doesn't Work With Virtual Host In Xampp

Or try changing your route to

Route::get('/about', [
    'as' => 'about', 'uses' => '[email protected]'
]);

cviv left a reply on Routes Doesn't Work With Virtual Host In Xampp

Try to hover at your or view page source if it point to laravel.localhost:8080/about. If not, that's the source of you invalid links..

cviv left a reply on I Want To Know What Reason Behind It

This will also give you an error

You must indicate which column you want to display like $user->id

cviv left a reply on Routes Doesn't Work With Virtual Host In Xampp

Did you check the url of your links?

cviv left a reply on POST Causing Errors

I cand see any fault in your form.. Maybe it's somewhere in your routes.

cviv left a reply on POST Causing Errors

What url/route was included in your form.blade?

cviv left a reply on Migrate

Use only $table->timestamps();

cviv left a reply on Syntax Error Or Access Violation

But if want to lessen some lines, you might do it this way

$appTops = App::orderBy('id','desc')->take(2)->get(); $appCount = App::count();

cviv left a reply on Syntax Error Or Access Violation

Use this.. $count = App::count();

cviv left a reply on Syntax Error Or Access Violation

You need groupBy in your query.. As stated..

cviv left a reply on Auth Not Working On Other Computer

Try checking if they both have the same time... Tried this with mine because a session var have a definite lifetime in your config/session.php

cviv left a reply on I Have Issue In Laravel Random() Query .

If your query return only 9 records it will not give you 10 records and try to change your query to $data = User::where('id','<>',5)->get()->random(10);

20 Mar
2 years ago

cviv left a reply on After Registration App Redirects To '/home' Even After Changing $redirectTo Variable To '/'

What's in your [email protected]? Or where are you redirecting your authenticated users?

cviv left a reply on After Registration App Redirects To '/home' Even After Changing $redirectTo Variable To '/'

Check your web.php this might be your case

Route::get('/', function () {
    return redirect('/home');
});

you might need to change it.

19 Mar
2 years ago

cviv left a reply on Feedback To My Media Sharing Site

@Chris1904 isn't is ironic that you ask your client to downgrade his subscription?

What do you mean by "use of excessive bandwidth"? Does this mean that a video with 1000 concurrent view will be flagged?

How do you check for the files' copyright? Is this, a wait until someone sends me notifications? AFAIK someone already uploaded videos to your site.

You have a very good concept. Keep it up.

cviv left a reply on Query Builder Inner Join Return Wrong Id

Wil this return the id? $table = \app\nilai::where('id_course',$search_param)->join('mahasiswa','nilai.id_mahasiswa' , '=', 'mahasiswa.id') ->get();

09 Mar
2 years ago

cviv left a reply on Time In My Table

Use $table->date('columnName'); and $table->time('columnName');

07 Mar
2 years ago

cviv left a reply on Where In Array

use whereIn, read this

cviv left a reply on How To Output Data Using Query Builder While Eliminating Duplicates

how about

  public function searchStudent(){

$a= Input::get( 'adm_no' );
$e= Input::get( 'exam_id' );
$t= Input::get( 'term_id' );
$y= Input::get( 'year' );
$results=DB::table('results')->distinct('subject_id')
->where( 'adm_no', $a)
->where( 'exam_id', $e)
->where( 'term_id',$t)
->where( 'year',$y)
->groupBy('subject_id')
->latest()
->first();
dd($results);
}