davy_yg

davy_yg

Member Since 2 Years Ago

Jakarta

Experience Points
92,160
Total
Experience

2,840 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
442
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 19
92,160 XP
Mar
28
2 days ago
Activity icon

Replied to Failed Send Email Through Yahoo

It works! I wonder why there is a time delay? The next day it works!

Also why yahoo mail using ssl while gmail using tls?

Mar
27
3 days ago
Activity icon

Replied to Failed Send Email Through Yahoo

I get :

419 Page Expired

When I checked the laravel.log

[previous exception] [object] (Swift_IoException(code: 0): Connection to tcp://smtp.mail.yahoo.com:465 Timed Out at E:\xampp72\htdocs\laravel_trainning\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php:166) [stacktrace]

Activity icon

Replied to Failed Send Email Through Yahoo

Then I get:

Swift_TransportException Connection to tcp://smtp.mail.yahoo.com:465 Timed Out

Activity icon

Started a new Conversation Failed Send Email Through Yahoo

Hello,

I successfully send contactus email with this setting through my website:

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME=LaravelTraining
[email protected]

Now, I wonder is it possible if I am using my yahoo email?

MAIL_DRIVER=smtp
MAIL_HOST=smtp.yahoo.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME=LaravelTraining
[email protected]

I get the following error: Swift_TransportException Connection could not be established with host smtp.yahoo.com :stream_socket_client(): unable to connect to tcp://smtp.yahoo.com:465 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )

Mar
26
4 days ago
Activity icon

Awarded Best Reply on Validation

Find it,

 $file = $request->file('foto');

It should be foto instead of photo.

Activity icon

Replied to Validation

Find it,

 $file = $request->file('foto');

It should be foto instead of photo.

Activity icon

Started a new Conversation Validation

I wonder why eventhough I uploaded an word doc or extra large email. The validation error message does not appears?

ProfileController.php

public function update(Request $request, $id)
	{
    $this->validate($request,[
        'nim' => 'required|digits:8',
        'nama' => 'required',
        'alamat' => 'required'
    ]);

    $profile = Profile::find($id);

    $file = $request->file('photo');

    if($file){

        $this->validate($request,[
            'foto' => 'required|image|dimensions:max_width=250, max_height=250'
        ]);
        // storage/app/public/photo/random.jpg
        $path = $request->file('photo')->store('public/photo');
        $profile->photo = $path;
    }

    $profile->nim = $request->nim;
    $profile->nama = $request->nama;
    $profile->alamat = $request->alamat;

    $profile->update();

    Session::flash('flash', 'Successfully update data');

    return redirect()->back();
	}
Mar
25
5 days ago
Activity icon

Replied to Registration Controller

I eventually try it and it works! Thanks.

Activity icon

Replied to Registration Controller

ok check this out:

public function destroy($id)
	{
	$mark = Profile::where('id', $id)->delete();

	if($mark){

		Session::flash('flash', 'Successfully delete data');		
	}

	$data = Profile::all();

	return view('admin.index')->with('list', $data);

}

Since it is delete can I write it this way:

return redirect()->route('admin.index')->with('list', $data);

?

Activity icon

Started a new Conversation Registration Controller

RegistrationController.php

use Hash;
use Session;
use App\User;

class RegistrationController extends Controller
{

public function index()
{
	return view('registration');
}

public function store(Request $request)
{
$this->validate($request,{
	'name' => 'required',
	'email' => 'required',		
	'password' => 'required'
};

$user = new User;
$user->name = $request->name;
$user->email = $request->email;
$user->password = Hash::make($request->password);
$user->save();

Session::flash('flash', 'Successfully add user');

return redirect()->route('admin.login');

}


?>

For the return now I wonder when do I have to use :

redirect()->route('admin.login');

and when to use:

return view('admin.login');

1 For adding data I heard it is best to use redirect()->route('admin.login');

What about return view('admin.login') ?

2 Is it for index function to show the listing data ?

3 what about update?

Is it best to use

redirect()->route('admin.login');

as well?

Mar
24
6 days ago
Activity icon

Replied to Login

Now, it works!

.fixed-top
{
position: absolute;
top: 0;
width: 100%;
}
Activity icon

Replied to Login

Now, the red color background only show with a limited width instead of full horizontal width. Any clue why?

login.blade.php

<span class="fixed-top">
@if($errors->any())
<div class="alert alert-danger">
	@foreach($errors->all() as $error)
		<li>{{ $error }}</li>
	@endforeach
</div>
@endif
</span>

login.css

.fixed-top
{
position: fixed;
top: 0;
}
Activity icon

Replied to Login

yes

Activity icon

Replied to Login

It still not making any diffferent. If there are error messages, then the login being pushed down. Is it normally like that?

Activity icon

Started a new Conversation Login

Hello,

I have a question: when trying to show the error message. My login content being pushed one space down. Is there any way not to do so? note: if there is error messages.

login.blade.php

@if($errors->any())
<div class="alert alert-danger">
	@foreach($errors->all() as $error)
		<li>{{ $error }}
	@endforeach
</div>
@endif
Mar
17
1 week ago
Activity icon

Replied to Sendmail

I did:

php artisan cache:clear

and it didn't work.

Activity icon

Awarded Best Reply on Sendmail

It is solved.

php artisan optimize:clear

and I tested the contact form again.

Activity icon

Replied to Sendmail

It is solved.

php artisan optimize:clear

and I tested the contact form again.

Activity icon

Replied to Sendmail

This is strange it works on my other website the same .env

How about this:

ContactController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Mail;
use App\Mail\ContactMail;
use Session;

class ContactController extends Controller
{
	//
	public function contact()
	{

	return view('contact');
	}

	public function sendmail(Request $request)
 {

	Mail::to('[email protected]')
		->send(new ContactMail($request->all()));

	Session::flash('flash', 'Successfully send message');

	return view('contact');
	}
}

Mail::to('[email protected]')

Is that fine?

Mar
16
2 weeks ago
Activity icon

Replied to Sendmail

I cannot understand a word in the link. I also cannot find the same symbol that looks a like. What did you do? Did you generate a new password?

Activity icon

Replied to Sendmail

Perhaps it has something to do with the password.

I try to create another app password:

Your app passwords Name Laravel

Contacts on my Windows Computer

and use the password in my .env yet it does not work.

So it's not my gmail password then.

ref: https://support.google.com/accounts/answer/185833?hl=en

Activity icon

Replied to Sendmail

For some reason I cannot found this button:

Allow less secure apps" ON.

I can only see security tabs with the following info:

Security issues found Protect your account now by resolving these issues Secure account Signing in to Google Password Last changed Sep 22, 2018  2-Step Verification On  App passwords 1 password  Ways we can verify it's you These can be used to make sure it's really you signing in or to reach you if there's suspicious activity in your account Recovery phone 0855-5555-5555  Recovery email [email protected]  Recent security events New sign-in on Windows South Tangerang City, Banten, Indonesia - Mar 3 Review security events Your devices You’re currently signed in to your Google Account on these devices Windows South Tangerang City, Banten, Indonesia This device Samsung Galaxy A20s Indonesia - 4:43 PM Linux South Tangerang City, Banten, Indonesia - Feb 25 +2 more Find a lost device Manage devices Signing in to other sites Signing in with Google You use your Google Account to sign in to 3 sites and apps  Password Manager You have 15 passwords saved in your Google Account. Password Manager makes it easier to sign in to sites and apps you use on any signed-in device.  Linked Accounts You have no linked accounts. You can give Google access to data from your third-party sites and apps, like your playlists.

Activity icon

Replied to Sendmail

I already read some articles and have not find the answer yet.

Username and Password not accepted

I check my username and password it works just fine.

Activity icon

Replied to Sendmail

It doesn't work. The same error still appears.

Activity icon

Started a new Conversation Sendmail

When sending mail message I get the following error:

Swift_TransportException Failed to authenticate on SMTP server with username "davy.yg1@gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor p70sm9665233pjp.47 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor p70sm9665233pjp.47 - gsmtp ". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials p70sm9665233pjp.47 - gsmtp ".

I wonder why:

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME=Testing
[email protected]

ref: https://stackoverflow.com/questions/33939393/failed-to-authenticate-on-smtp-server-error-using-gmail

Mar
13
2 weeks ago
Activity icon

Replied to Update

I changed the route to:

Route::put('profile/{profile}', '[email protected]')->name('profile.update');

and I still have this error:

The POST method is not supported for this route. Supported methods: PUT, DELETE.

ref: https://laravel.com/docs/7.x/controllers#resource-controllers

Activity icon

Replied to Update

web.php

Route::put('profile/update', '[email protected]')->name('profile.update');
Activity icon

Started a new Conversation Update

I also wonder why I get this error message on update:

<form method="get" action="{{ route('profile.update', $list->id) }}" enctype="multipart/form-data">
@csrf
@method('PUT')

The POST method is not supported for this route. Supported methods: PUT, DELETE.

I thought I already define the put method.

Activity icon

Replied to 419 Page Expired

I refresh it and now it works!

So this is correct then:

Route::delete('profile/{profile}', '[email protected]')->name('profile.destroy');
Activity icon

Replied to 419 Page Expired

I change it to this:

index.blade.php

 <td><a href="{{ route('profile.edit', $item->id) }}">Edit</a>
	<a href="{{ route('profile.destroy', $item->id) }}">Delete</a></td>

and still get the following error:

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The GET method is not supported for this route. Supported methods: POST.

Any clue why?

Activity icon

Started a new Conversation 419 Page Expired

Hello,

I get : 419 Page Expired

error after adding these codes:

index.blade.php

<td><form action="{{ route('profile.edit', $item->id) }}" method="GET">
		@csrf
		<button type="submit" class="btn btn-primary">Edit</button>
	</form>
	<form action="{{ route('profile.destroy', $item->id) }}" method="POST">
		@csrf
		@method('DELETE')
		<button type="submit" class="btn btn-primary">Delete</button>
	</form>
</td>	

web.php

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

I also confuse is there such as thing as route::delete ?

After pressing refresh several times this error appears:

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException

The GET method is not supported for this route. Supported methods: POST.

Activity icon

Replied to Call To A Member Function Store() On Null

Perhaps you are right. Earlier I have double post when trying to add the profile.

Will it works just fine with:

return redirect()->back();

?

What exactly should I write the return?

Activity icon

Replied to Call To A Member Function Store() On Null

For some reason using view still works just fine.

return view('admin.add_profile');
Activity icon

Replied to Call To A Member Function Store() On Null

Let say I want to return to the store function:

Route::post('profile', '[email protected]')->name('profile.store');

so it will be like:

redirect store();

like that?

Activity icon

Started a new Conversation Edit

For editing is using route is requirement?

 <td><a href="{{ url('profile/{profile}/edit') }}">Edit</a> Delete</td>

I only wonder how to pass the id?

Activity icon

Replied to Call To A Member Function Store() On Null

Then what should I return? since I have to return to the same page to get the error validation message.

Activity icon

Started a new Conversation Call To A Member Function Store() On Null

Any clue why I get this error:

Call to a member function store() on null

ProfileController.php

 public function store(Request $request)
	{
	$this->validate($request,[
		'photo' => 'required',
		'nim' => 'required',
		'nama' => 'required',
		'alamat' => 'required'
	]);

	$profile = new Profile;
	// $profile->photo = $request->photo;

	// storage/app/photo/random.jpg
	$path = $request->file('photo')->store('public/photo');
	$profile->photo = $path;

	$profile->nim = $request->nim;
	$profile->nama = $request->nama;
	$profile->alamat = $request->alamat;
	$profile->save();

	Session::flash('flash', 'Data sudah tersimpan');

	return view('admin.add_profile');
	}

add_profile.blade.php

<form method="post" action="{{ url('profile') }}" enctype="multipart/form-data">
@csrf
<div class="form-group">
	<label>Photo</label>
	<input class="form-control" name="photo" type="file" placeholder="Enter email">
</div>
<div class="form-group">
	<label>NIM</label>
	<input class="form-control" name="nim" type="text" placeholder="Enter NIM">
</div>
<div class="form-group">
	<label>Nama</label>
	<input class="form-control" name="nama" type="text" placeholder="Enter Name">
</div>
<div class="form-group">
	<label>Alamat</label>
	<input class="form-control" name="alamat" type="text" placeholder="Enter Address">
</div>
<br>
<button class="btn btn-primary">Submit</button>

ref: https://laracasts.com/discuss/channels/laravel/call-to-a-member-function-store-on-null-3

Activity icon

Started a new Conversation Add Profile Button

Hello,

I wonder why the add profile button does not work?

index.blade.php

<button class="btn btn-primary" onclick="{{ url('profile/create') }}">Add Profile</button><br><br>

web.php

Route::get('profile/create', '[email protected]')->name('profile.create');

ProfileController.php

class ProfileController extends Controller
{
	//

public function create() { return view('admin.add_profile'); } }

Mar
12
2 weeks ago
Activity icon

Replied to Registration Form

I already found the answer. I forgot a semi colon:

$this->validate($request, [
	'name' => 'required',
	'email' => 'required',
	'password' => 'required'
]);
Activity icon

Started a new Conversation Registration Form

Hello,

I am trying to create a registration form

RegistrationController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Session;
use app\User;

class RegistrationController extends Controller
{
	//
	public function index()
	{
	return view('registration');
	}

	public function store(Request $request)
 {

	$this->validate($request, [
		'name' => 'required',
		'email' => 'required',
		'password' => 'required'
	])

	$user = new user;
	$user->name = $request->name;
	$user->email = $request->email;
	$user->password = $request->password;
	$user->save();

	Session::flash('flash', 'Successfully add data');

	return view('registration');

	}
}

app/User.php

<?php

namespace App;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
	use Notifiable;

 /**
 	* The attributes that are mass assignable.
 	*
 	* @var array
 	*/

protected $fillable = [
    	'name', 'email', 'password',
	];

	/**
 	* The attributes that should be hidden for arrays.
 	*
 	* @var array
 	*/

protected $hidden = [
    	'password', 'remember_token',
 ];

	/**
 	* The attributes that should be cast to native types.
 	*
 	* @var array
 	*/

protected $casts = [
    	'email_verified_at' => 'datetime',
	];
}

The user is using the default laravel user table.

I wonder why the error appears:

ParseError syntax error, unexpected '$user' (T_VARIABLE) http://localhost/laravel_training/public/registration

Mar
11
2 weeks ago
Activity icon

Started a new Conversation Validation

LoginController.php

public function dologin(Request $request) {
    $input = $request->validate(
        [
            'email' => 'required',
            'password' => 'required',
        ], 
        [
            'email.required' => 'Email is required',
            'password.required' => 'Password is required',
        ]
    );

I wonder if $input variable is necessary?

ref: https://laravel.com/docs/7.x/validation#introduction

Why would you store the result of the validation to a variable? What's the point?

Activity icon

Replied to Installing Laravel

This is what happen before I install

composer global require laravel/installer

E:\xampp72\htdocs>laravel new laravel_training 'laravel' is not recognized as an internal or external command, operable program or batch file.

Activity icon

Started a new Conversation Installing Laravel

When installing laravel, I wonder why I have to run:

composer global require laravel/installer

before running:

laravel new blog

Does it install a file somewhere?

ref: https://laravel.com/docs/7.x

Mar
06
3 weeks ago
Activity icon

Started a new Conversation Component

Hello,

I am trying to understand what is make:component are for?

You can use view and controller to make component as usual right?

ref: https://laravel.com/docs/7.x/blade#components

Mar
03
3 weeks ago
Activity icon

Replied to Trying To Get Property 'group_name' Of Non-object

ContactsController.php

public function index()
{
    //
    $data = Contacts::all();  

    return view('admin.home.contacts')->with('list', $data);
}
Activity icon

Replied to Trying To Get Property 'group_name' Of Non-object

Here is the result:

Groups {#10273 ▼
  #table: "groups"
#connection: "mysql"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
  +exists: true
  +wasRecentlyCreated: false
#attributes: array:4 [▼
        "id" => 1
        "group_name" => "Eligendia"
        "created_at" => "2020-03-03 04:11:32"
        "updated_at" => "2020-03-03 05:46:32"
    ]

#original: array:4 [▼
        "id" => 1
        "group_name" => "Eligendia"
        "created_at" => "2020-03-03 04:11:32"
        "updated_at" => "2020-03-03 05:46:32"
    ]
Activity icon

Started a new Conversation Trying To Get Property 'group_name' Of Non-object

I get an error message in here:

 @foreach($list as $item)  
          <tr>
            <td>{{ $item->id }}</td>
            <td>{{ $item->group->group_name }}</td>

Model/Contacts.php

<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Contacts extends Model
{
    //
    protected $table = 'contacts';

    public function group()
    {
        return $this->belongsTo('App\Model\Groups', 'group_id', 'id');
    }
}

I have two tables:

groups

id, group_name,

contacts

id, avatar, first_name, last_name, ... , group_id

Any clue why group_name is non-object? I already create the relation.

Activity icon

Started a new Conversation Push To Github

Hello,

I am using tortoise git trying to push my files to github and I ge the following messages:

[email protected] MINGW64 /e/xampp72/htdocs/niche_stack (master) $ git add . fatal: Unable to create 'E:/xampp72/htdocs/niche_stack/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue.

What should I do?

Activity icon

Replied to Avatar

I have to use this: https://github.com/ottaviano/faker-gravatar

temporarily the only problem is if I upload a local image the image won't show off.