Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

mlazuardy

Experience

4,980

0 Best Reply Awards

  • Member Since 3 Months Ago
  • 4 Lessons Completed
  • 0 Favorites

14th December, 2017

mlazuardy left a reply on Avoid HTML Tag/blade Inside Source Code Editor On Markdown To Be View • 8 hours ago

Im sorry for bad explanation and bad english, but i found the trouble, its say vue error compiling assets, but i dont know what's that mean? @RiccardoGaleazzi do you have any idea?

mlazuardy left a reply on Avoid HTML Tag/blade Inside Source Code Editor On Markdown To Be View • 15 hours ago

  1. Expected result here https://i.imgur.com/Myte9s0.png
  2. Actual Result inside admin panel Here https://i.imgur.com/eie7s8O.png
  3. Actual Result in post/show method https://i.imgur.com/WGThTDS.png
  4. Souce Code inside post/show https://i.imgur.com/G7xTcUT.png

please help me, i cant write amateur tutorials in my website

mlazuardy left a reply on Avoid HTML Tag/blade Inside Source Code Editor On Markdown To Be View • 15 hours ago

okay i hope you'll understand. i use SimpleMDE (markdown editor) to save my Body Column inside posts table, where Body is input in textarea like this

   <div class="field ">
                  <textarea name="body" id="text-editor" cols="30" rows="10"></textarea>
                 </div>

after that, i call the id of my textarea in the bottom of my view.blade

<script >
  var simplemde = new SimpleMDE({ element: document.getElementById("text-editor"), spellChecker: false });
  $("input, text-editor, select").change(function() {
    contentChanged(true);
});
  </script>

if i create the post, all working perfectly, and i use laravel/parsedown to parsing the markdown inside text-area and turn the markdown style into html tag. and collect the body column inside the posts table like this

{!! parsedown($post->body) !! } 

They all work Good, But when i input the source code inside the triple backtick ( i insert default of laravel register.blade.php ) between the backtick so I expected they will show as source code like we use on Laracast ( triple backtick->code>triple backtick) But the code is generate into html tag, But didnt show in my post/show, they all dissapear. they didnt generate my code inside triple backtick into pre>code.

13th December, 2017

mlazuardy left a reply on Avoid HTML Tag/blade Inside Source Code Editor On Markdown To Be View • 1 day ago

store method


    public function store(Request $request, Tag $tag)
    {
        $this->validate(request(), [
        'title'    =>'required|max:100',
        'body'    =>'required',
        'category_id'  =>'required',

      ]);

        $post = new Post;
        $post->title = title_case($request->title);
        $post->body  = $request->body;
        $post->slug  = str_slug($request->title);
        $post->excerpt = str_limit($request->body,100);
        $post->category_id = $request->category_id;
        $post->meta_description = str_limit($request->body,200);
        $post->meta_keywords = $request->title;
        $post->seo_title    = $request->title;
        //save Image
        if ($request->hasFile('image')) {
            $request->file('image')->store('public/posts/'.$request->user()->username);
            $post->image = $request->file('image')->hashName('posts/'.$request->user()->username.'/');
        }

        $tags_id = [];
        if ($request->tags) {
            $tags = explode(',', $request->tags);
            foreach ($tags as $tag) {
                $tag_ref = Tag::firstOrCreate(['name' => str_slug($tag, '-')]);
                $tags_id[] = $tag_ref->id;
            }
        }
        $post->save();
        Alert::message('Selanjutnya akan di Review Oleh Admin', 'Artikel Sukses Dibuat')->persistent('close');
        $post->tags()->sync($tags_id);
        return redirect('/profile/post')->with('success', 'Post Berhasil dibuat');
    }

show method

  public function show($slug)
    {
        $blog_key = 'blog_'.$slug;
        if (!Session::has($blog_key)) {
            Post::where('slug', $slug)->increment('view_count');
            Session::put($blog_key, 1);
        }
        $bestPosts = Post::where('featured', 1)->paginate(3);
       
       $post = Post::where('slug', $slug)
                ->where('status', 'PUBLISHED')
                  ->firstOrFail();
            $tags = $post->tags->map(function ($tag) {
            return $tag->name;
        });
        $commentPaginator = $post->comments()->paginate(10);
        if (!$post) {
            abort(404);
        }
        return view('post.show')->with(['post'=>$post,'commentPaginator'=>$commentPaginator,'bestPosts'=>$bestPosts,'tags'=>$tags]);
    }

any wrong with it ? @RiccardoGaleazzi

mlazuardy left a reply on Avoid HTML Tag/blade Inside Source Code Editor On Markdown To Be View • 1 day ago

what do you mean? i dindnt have any view name except blade. only blade.php sir

but the triple backtick its going to be paragraph, not pre code if i use php source code it work normal, but if i use that blade syntax and html. they renderit into html tag . and dissappear @RiccardoGaleazzi

mlazuardy left a reply on Avoid HTML Tag/blade Inside Source Code Editor On Markdown To Be View • 1 day ago

i use the markdown for source code like this

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Register</div>

                <div class="panel-body">
                    <form class="form-horizontal" method="POST" action="{{ route('register') }}">
                        {{ csrf_field() }}

                        <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                            <label for="name" class="col-md-4 control-label">Name</label>

                            <div class="col-md-6">
                                <input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required autofocus>

                                @if ($errors->has('name'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label for="email" class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label for="password" class="col-md-4 control-label">Password</label>

                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control" name="password" required>

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>

                            <div class="col-md-6">
                                <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    Register
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

but the source code is render to be an html and then. they show the All inside the triple backtick, not the code, please help me

mlazuardy started a new conversation Avoid HTML Tag/blade Inside Source Code Editor On Markdown To Be View • 1 day ago

i dont know what this problem call it, but when i want to use triple backtick and put my source code of blade, save it and display it, All of my html body dissapear, i dont know why but can somebody help me?

mlazuardy left a reply on Calling {!! $post->body !!} Make My Page Dissapear • 1 day ago

i guess this is because RichText Editor from Tiny MCE, they overide pre>code and display into html tag, holy shit , i guess i must change this, sorry sir and thanks for comment, i close it

mlazuardy started a new conversation Calling {!! $post->body !!} Make My Page Dissapear • 1 day ago

I dont know what's wrong with my code but if i use

{!!$post->body !!} in my view,my page is dissapear, whats wrong with this?

10th December, 2017

mlazuardy left a reply on Remove Unwanted Text From Database • 4 days ago

$post->body = str_limit(strip_tags($requset->body)/*strlimit number is here? */);

@kobear

9th December, 2017

mlazuardy left a reply on Remove Unwanted Text From Database • 4 days ago

can i use 2 helper in the same request like

$post->body = strip_tags(str_limit($requset->body));

can i ?

mlazuardy started a new conversation Remove Unwanted Text From Database • 5 days ago

so i make a Create Article and use TinyMCE for Editing the text. TinyMCE will also store the html tag in our datatable, what's the problem? the problem is i want to insert the body of my Article into my meta description with str_limit also, but they also include the html tag because of TinyMCE (or maybe other RichTextEditor too),

The Question is, how to remove unwanted html tag in the meta descrition like

or any tag html that i dont want it?

7th December, 2017

mlazuardy left a reply on Delete All Relationship User [user->profile->social_accounts] • 6 days ago

the second part of delete is right, but the method i use is just

public function delete()

thank you for your reply. i appreciated @mcangueiro

mlazuardy started a new conversation Delete All Relationship User [user->profile->social_accounts] • 1 week ago

i have three related of my model, user has one profile, user has one social account, but the profile and social account have no relationship. in this case. i want to use 1 method to delete all of user information. in this case, when i delete user row, all of the table related such a profile and social_account will be deleted too, in a basic usage of delete method is

public function delete($id)
{
$user = User::find($id);
$user->delete();
}

but how to delete all of the relationship too? sorry bad english

6th December, 2017

mlazuardy left a reply on Whats The Logic To Make EXP Point Like Laracast? • 1 week ago

so i add many handle eventlistener to to the point of adjustment? @martinbean

5th December, 2017

mlazuardy left a reply on Delete Post/Blog Image • 1 week ago

its still in development sir, and what i want to build is my user cant delete the files except admin, but what if i have too much user . and what they do is editing its post image . it will make me crazy to deleting the file manually, and also i will make a mistake when deleting file manually, so i want to know how to delete the image when the new image of the post is updated @bashy

4th December, 2017

mlazuardy left a reply on Delete Post/Blog Image • 1 week ago

if im dd($oldimage) i see the storage of the blog image sir @bashy

mlazuardy started a new conversation Delete Post/Blog Image • 1 week ago

i try to deleting the old image of my blogs table but it wont delete, this is my update method


        if ($request->hasFile('image')) {
             $oldimage = $post->image;
          Storage::delete($oldimage);
            $request->file('image')->store('public/posts/'.$request->user()->username);
            $post->image = $request->file('image')->hashName('posts/'.$request->user()->username.'/');
        }

what's wrong with this?

3rd December, 2017

mlazuardy started a new conversation Configuring The Database For Oauth2 Login/ Socialite • 1 week ago

im try to make new tables call "social_account" who have one to one relationship with users the social_accounts table columns is id use_id provider provider_user_id timestamp

so sometimes for example, if we create github account (and not fill the Name Input) . that mean, we can retrieve the github Name for our users -> name

and also the password, i guess we must change the password column to nullable so my question is, is there column from users table need to configure? except password and name ('because im already say it') sorry for my bad english. i hope you guys undestand

2nd December, 2017

mlazuardy left a reply on Whats The Logic To Make EXP Point Like Laracast? • 1 week ago

so the points_adjustments is have polymorphic relationship to any table that i want to fill the point @martinbean

mlazuardy left a reply on Whats The Logic To Make EXP Point Like Laracast? • 1 week ago

then i must create new table associated with users table with Polymorphic? how much column i input to the point_adjustments table? @martinbean

mlazuardy left a reply on Incrementing Coin Where Status Of Post Has Been Published • 1 week ago

3 days i've been waiting for reply sir then why i make new thread again, sorry @martinbean

mlazuardy left a reply on Whats The Logic To Make EXP Point Like Laracast? • 1 week ago

can you give me full of method i must to input ? because i dont know, i just know to $post->user()->increment('exp',100); but when the post is change to published? how? @Thyrosis

mlazuardy left a reply on Whats The Logic To Make EXP Point Like Laracast? • 1 week ago

in my case, i have to verified the status of the "Post" sir, where the default status is "Draft" so, the drafted status of the post isnt get any exp, they get when the "admin" of my website is change the status of the post to "PUBLISHED" , do you have any idea to make that? @Thyrosis sis

mlazuardy started a new conversation Incrementing Coin Where Status Of Post Has Been Published • 1 week ago

i want to make and exp point like laracast, in this case i'm using name "coin" so the default of the article status is "DRAFT", i want to increment the coin where the "admin" has change the status of article to "PUBLISHED"

what kind of method should i input it , using controller or model to increment this coin?

mlazuardy left a reply on Passing User To Get Notifications • 1 week ago

sorry , i guess i need to use Notifiable in Post on Voyager model, but when i insert to Voyager User model, it work , thanks

mlazuardy left a reply on Passing User To Get Notifications • 1 week ago

i try to use to voyager model but its still get same error @Snapey

mlazuardy left a reply on Passing User To Get Notifications • 1 week ago

yeah im extending the user class on voyager user class, so do you mean i need to put the notifiable to voyager user class too? @Snapey

mlazuardy left a reply on Passing User To Get Notifications • 1 week ago

whoops say like this my friend @Snapey

"Call to undefined method Illuminate\Database\Query\Builder::notify()

i try it before

mlazuardy left a reply on Passing User To Get Notifications • 1 week ago

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use TCG\Voyager\Models\Post;
use TCG\Voyager\Models\User as VoyagerModelUser;
use TCG\Voyager\Traits\VoyagerUser;
use Auth;
use Carbon\Carbon;

class User extends \TCG\Voyager\Models\User
{
    use  Notifiable,VoyagerUser;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
     protected $fillable = [

         'username',
         'name',
         'email',
         'password',
         'avatar',
         'verified',
     ];
     //verify token on email verification
     public function verificationToken()
     {
       return $this->hasOne(VerificationToken::class);
     }

    public function hasVerifiedEmail()
    {
        return $this->verified;
    }
    public static function byEmail($email)
    {
        return static::where('email', $email);
    }


    public function getAvatarAttribute($value)
    {
        if (is_null($value)) {
            return config('voyager.user.default_avatar', 'users/default.png');
        }

        return $value;
    }

    public function setCreatedAtAttribute($value)
    {
        $this->attributes['created_at'] = Carbon::parse($value)->format('Y-m-d H:i:s');
    }
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token','email_token'
    ];

    public function posts()
    {
        return $this->hasMany('App\Post', 'author_id');
    }

    public function events()
    {
        return $this->hasMany('App\Post', 'author_id');
    }

    public function profile()
    {
        return $this->hasOne('App\Profile');
    }
    public function profiles()
    {
        return $this->belongsToMany('App\Profile')->withTimestamps();
    }
    public function hasProfile($name)
    {
        foreach ($this->profiles as $profile) {
            if ($profile->name == $name) {
                return true;
            }
        }

        return false;
    }
    public function isCurrent()
    {
        if (Auth::guest()) {
            return false;
        }
        return Auth::user()->id == $this->id;
    }
    public function comments()
    {
        return $this->hasMany('App\Comment');
    }

    public function portfolios()
    {
        return $this->hasMany('App\Portfolio');
    }

    ///student relationship
    public function students()
    {
        return $this->hasMany('App\Student', 'author_id');
    }


}

i use voyager to extends my model

mlazuardy left a reply on Passing User To Get Notifications • 1 week ago

yes sir, i set up correctly @VijayKadiyam

mlazuardy started a new conversation Passing User To Get Notifications • 1 week ago

i get some errors to passing the notification to the user created the post so the method is.

 
    public function store(Post $post)
    {
        Comment::create([
          'body' => request('body'),
          'post_id' => $post->id,
          'user_id' =>Auth::user()->id
        ]);
    
        $post->authorId()->notify(new CommentToPost($post));
        return back()->with('success', 'Komentar berhasil dibuat');
    }

the relationship of author id is

  public function authorId()
    {
        return $this->belongsTo(Voyager::modelClass('User'), 'author_id', 'id');
    }
```
but i get error like this
```
Call to undefined method Illuminate\Database\Query\Builder::notify()
```
what i miss ?

mlazuardy left a reply on File Upload Didnt Update • 1 week ago

what do you mean ? change the fillable to guarded? @Dunsti

1st December, 2017

mlazuardy left a reply on Whats The Logic To Make EXP Point Like Laracast? • 1 week ago

okey , the next question is, sync the amount of "when replies, when get best reply , or whenever we act" how to set the logic/method to set the value ? @Thyrosis

mlazuardy started a new conversation Whats The Logic To Make EXP Point Like Laracast? • 1 week ago

just a simple question in title

28th November, 2017

mlazuardy left a reply on Set Multiple Email In Env/mail.php • 2 weeks ago

so do i need to use this too @samo ?

    $existing = config('mail');

      dd($existing);

      $new =array_merge(
          $existing, [
          'from' => [
              'address' => '[email protected]',
              'name' => 'Support Services',
              ],
          ]);

      config(['mail'=>$new]);

mlazuardy left a reply on Set Multiple Email In Env/mail.php • 2 weeks ago

null sir

array:9 [▼
  "driver" => "smtp"
  "host" => "smtp.mailtrap.io"
  "port" => "465"
  "from" => array:2 [▼
    "address" => null
    "name" => null
  ]
  "encryption" => "tls"
  "username" => "9dd6a2052a75f1"
  "password" => "7934a7834e419a"
  "sendmail" => "/usr/sbin/sendmail -bs"
  "markdown" => array:2 [▶]
]

27th November, 2017

mlazuardy left a reply on Set Multiple Email In Env/mail.php • 2 weeks ago

i add the new function now but still same error

"Cannot send message without a sender address"

mlazuardy left a reply on Set Multiple Email In Env/mail.php • 2 weeks ago

here sir

<?php

namespace App\Mail;

use App\VerificationToken;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendVerificationToken extends Mailable
{
    use Queueable, SerializesModels;
    public $token;
    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(VerificationToken $token)
    {
        $this->token = $token;
    }
    private function setMailFromSupport()
  {
      $existing = config('mail');
      $new =array_merge(
          $existing, [
          'from' => [
              'address' => '[email protected]',
              'name' => 'Support Services',
              ],
          ]);

      config(['mail'=>$new]);
  }


    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {

      return $this
                  ->subject('Please verify your email')
                  ->view('email.verification');
    }
}

mlazuardy left a reply on Set Multiple Email In Env/mail.php • 2 weeks ago

im already inserting the function itu SendVerificationToken like

  private function setMailFromSupport()
  {
      $existing = config('mail');
      $new =array_merge(
          $existing, [
          'from' => [
              'address' => '[email protected]',
              'name' => 'Support Services',
              ],
          ]);

      config(['mail'=>$new]);
  }

but it come

Cannot send message without a sender address"

because the config/mail.php

'from' => [
        'address' => env('MAIL_FROM_ADDRESS'),
        'name' => env('MAIL_FROM_NAME'),
    ]

whats that mean? or in setMailFromSupport function i need to insert the username and password or what?

mlazuardy left a reply on Set Multiple Email In Env/mail.php • 2 weeks ago

okay one more question again sir, in the verificationToken (confirm account), the request cycle is Events/UserRegistered Events/UserRequestedVerificationEmail

Listeners/SendVerificationEmail

Mail/SendVerificationToken

Controlllers/VerificationController

Model/Verification Model/User (this both model use Relationship)

so where the function i must input to? @Snapey

mlazuardy left a reply on Set Multiple Email In Env/mail.php • 2 weeks ago

and do i need to change/delete the second argument in mail like this

'from' => [
        'address' => env('MAIL_FROM_ADDRESS'),
        'name' => env('MAIL_FROM_NAME'),
    ]

i use it but it come whoops that say

Cannot send message without a sender address"

@Snapey

mlazuardy left a reply on Set Multiple Email In Env/mail.php • 2 weeks ago

you mean i need to put that method inside App\Mail\myMail ? @Snapey

mlazuardy started a new conversation Set Multiple Email In Env/mail.php • 2 weeks ago

i need a lil' problem to configure, i want to set diferent email to sending email from different event, for example, to confirm user account, want to use [email protected] to sending welcome email to verified email account, i want to use [email protected]

in this case, the env email is set for just 1 email, and i need some configuration to set the email for different event how to set this? my env is

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

and config/mail is

  'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'No-Reply'),
    ],

i guess i need to configure those stuff, but how ? can you help me guys?

25th November, 2017

mlazuardy left a reply on Problem Inputing Username On Usercontroller • 2 weeks ago

yes sir its working good with validation but i dont want the username to be inputed by user with space, it make the system lil' bad

mlazuardy left a reply on Problem Inputing Username On Usercontroller • 2 weeks ago

didnt work sir @Gabonator

mlazuardy started a new conversation Problem Inputing Username On Usercontroller • 2 weeks ago

i'm adding username column to my users table and give the update method to update users table, but something wrong with validation

if i didnt give the validation to give username require alpha_dash the method working good, but when i give validation username is require to input alpha_dash like

  $this->validate(request(), [
        'name'    =>'required|max:30',
        'username'    =>'required|max:30|alpha_dash|unique:users',
        ]);

it works to but the 'name' column/field didnt update anything, whats wrong with this?

mlazuardy left a reply on Url Show %2f Not Trailing Slash? • 2 weeks ago

SOLVED , change comma to dot

mlazuardy left a reply on [ErrorException] Symlink() Has Been Disabled For Security Reasons • 2 weeks ago

yes you right, i close this problem sir thanks

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.