mlazuardy

Experience

7,750

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 7 Lessons Completed
  • 0 Favorites

13th September, 2018

mlazuardy left a reply on Login To Another Social Account While Logged In • 1 month ago

@martinbean already have it, but when i click the link to the facebook provider . it redirect to the "/home" where the "/home" is middleware from "redirectIfAuthenticated"

mlazuardy started a new conversation Login To Another Social Account While Logged In • 1 month ago

I have 2 Socialite driver , facebook and google. While i'm logged in with facebook. in the users setting page i want to connect with google too, but it throw to the /home again maybe because middleware. So how to connect with another social driver while in logged in ? sorry bad english. this is my LoginController

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use App\User;
use App\Jobs\SendVerificationEmail;
use Socialite;
use Auth;
use App\SocialAccount;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/@';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    public function resend()
    {
        return view('auth.resend');
    }
    /**
     * middleware jika user belum verifikasi email
     */
    protected function authenticated(Request $request,$user)
    {
        if($user->verified == 0){
            $this->guard()->logout();
            return redirect('/login')->withErrors('Akun ini belum terverifikasi, silahkan cek email anda atau kirim ulang verifikasi');
        }
    }

    public function resendEmail(Request $request)
    {
        $email = $request->email;
        $user = User::where(['verified' => 0,'email'=> $email])->first();
        if (!$user){
            return redirect('/resend')->with('error','Invalid Email or Already Verified');
        }
        $user->email_token = base64_encode($request->email);
        $user->save();
        dispatch(new SendVerificationEmail($user));
        return redirect('/resend')->with('success','Verification successfully resend to your email');

    }
    /**
     * redirect to provider
     * @param Provider
     */
    public function redirectToProvider($provider)
    {
        return Socialite::driver($provider)->redirect();
    }
    /**
     * get data from social driver
     */
    public function handleProviderCallback($provider)
    {
        $user = $this->createOrGetUser(Socialite::driver($provider)->user(),$provider);
        Auth::login($user);
        return redirect('/@')->with('success',"Sukses login melalui {$provider}");
    }
    /**
     * buat jika akun user dari provider belum terdaftar
     */
    private function createOrGetUser($providerUser, $provider)
    {
        $account = SocialAccount::where('provider', $provider)
            ->where('provider_user_id', $providerUser->getId())
            ->first();
        if ($account) {
            //return account jika ditemukan
            return $account->user;
        } else {
            //Check jika terdapat email yang sama 
            $user = User::where('email', $providerUser->getEmail())->first();
            //buat user jika tidak ada email yang terdaftar, wow lihat ada if didalam else
            if (!$user) {
                $user = User::create([
                    'username' => str_random(10),
                    'first_name' => str_random(7),
                    'last_name' => str_random(7),
                    'email' => $providerUser->getEmail(),
                    'verified' => true,
                    'password' => null
                ]);
            }
            $user->socials()->create([
                'provider_user_id' => $providerUser->getId(),
                'provider' => $provider
            ]);
            return $user;
        }
    }
}

8th August, 2018

mlazuardy left a reply on Removing Files From Request Before Passing To Controller • 2 months ago

Try this

 if ($request->hasFile('image')) {
            unlink($image);
            $request->file('image')->store('public/blogs/' . $request->user()->id);
            $blog->image = $request->file('image')->hashName('blogs/' . $request->user()->id.'/');
        }

this is just example in update method, so configure it with your own Controller

11th June, 2018

mlazuardy left a reply on How To Display "You Need To Login First" • 4 months ago

@aurawindsurfing i know that sir, but what i expect is showing the message in login page

mlazuardy left a reply on How To Display "You Need To Login First" • 4 months ago

@Cronix really helpful thanks sir @Snapey just too make sure for user why they redirect to login page so i need to show the message

10th June, 2018

mlazuardy left a reply on How To Implement Settings Option In Laravel ? Like Social Link, Text Of Color, Text Of Size Etc Wan To Control By Setting ? • 4 months ago

@Cronix Right, but if he want to configure the text size just need a config file and maybe inline styling css with dynamic value of font-size or etc. Or if he want to config and always store the configuration of user like user background-color/bg-image profile. maybe a table can handle that too

mlazuardy started a new conversation How To Display "You Need To Login First" • 4 months ago

maybe i didnt need to show the code but my question is how to Display " You Need to login first to continue" when The Routes is protected by auth middleware in Login page ? sorry if this question is too easy for you guys. But really help and increase my knowledges

30th April, 2018

mlazuardy started a new conversation Laravel + React Native(Mobile App) Best Way To Create Authentication • 5 months ago

For Now i guess im already completed my Web Apps Production build with Laravel, So its time to started created REST Api for Mobile apps, im using React Native and want to create authentication too with Laravel Passport , using access_token when user create or login via Mobile like this

Api\UserController.php

 public function login()
    {
        if(Auth::attempt(['email'=> request('email'),'password'=> request('password')])){
            $user = Auth::user();
            $token = $user->createToken('HMI App')->accessToken;
            $status = 200;
        }else{
            $token = 'unauthorize';
            $status = 401;
        }
        return response()->json(['token' => $token],$status);
    }

So the problem is web applications use session to store user data, whereas if not wrong mobile app use access token to save / detect user login, My question is how to save or track the user if the user is LoggedIn or Not ? what should column/or things i add to my Mobile apps using Laravel Passport ? sorry, and thanks if you want to answer guys. Happy Mayday

29th April, 2018

mlazuardy left a reply on Send Blog Subcriber With Laravel Queue Email • 5 months ago

my current queue is database sir and you save me , thank you sir

mlazuardy started a new conversation Send Blog Subcriber With Laravel Queue Email • 5 months ago

I want to send when my Blog already been updated to "PUBLISHED", so i create the mailable like this

<?php

namespace App\Mail;

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

class SendBlogNotification extends Mailable
{
    use Queueable, SerializesModels;
    public $blog;
    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($blog)
    {
    
        $this->blog = $blog;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->subject('new Blog has been added')
        ->view('email.blognotification');
    }
}

and this mail is control by update method in controller named "StaffController" like this

    public function blogPublish($slug)
    {
        $blog = Blog::where('slug',$slug)->firstOrFail();
        $users = UserNotification::where('blog', 1)->get();
        $blog->status = "PUBLISHED";
        $blog->save();
        if($users){
            foreach ($users as $user) {
                Mail::to($user->user->email)->queue(new SendBlogNotification($blog));
            }
        }
        return redirect('dashboard/blog')->with('success','Blog Telah di Publish');
    }

UserNotification is 1 to 1 relationship between user and the subcribe page, when the UserNotification->blog is true, it will send the blog for blog subcriber,

for information, i already set up queue and supervisor like queue doc in laravel site ( im using ubuntu)

but when im updating blog to "published" the some of queue is failed call "SendBlogNotification has been attempted too many times or run too long. The job may have previously timed out"

what's wrong with this?

3rd April, 2018

mlazuardy left a reply on Just A Question About React JS • 6 months ago

Very right, first im split the component and also the store props to, but the when user click "add to cart" it doesnt dispatching data because the store props is different, so i use 2 Provider in 1 file, even the Provider is 2 , they have same store props so the i can dispatch the data from card to cart. but as you said, its cost performance issue and i should read that documentation from your link now.

and i think react are warning use to use the context api for intermediate js programmer,

thanks for your answer sir. i'll close this. @ejdelmonico

mlazuardy left a reply on Just A Question About React JS • 6 months ago

you mean not recommended is cost more performance to my app ? because i have an issue to use Redux and must to save same store in order to dispatch a function.

the issue is, i have a sample project to add cart from other component ,the cart is in navbar, and the component is in Product card. So i still can't find to store and dispatch to other component. because Cart and Card, didnt have same Provider @ejdelmonico

sorry for slow response sir

22nd March, 2018

mlazuardy started a new conversation Just A Question About React JS • 7 months ago

i want to know that if i render multiple ReactDOM in same file like

 ReactDOM.render(<Example />, document.getElementById('example'));
 ReactDOM.render(<Example2 />, document.getElementById('example2'));

is it call anti-pattern or not ? or is it a bad method or not ? sorry just ask :) and thank you

11th March, 2018

mlazuardy left a reply on Laravel React Redux Internal Server Error • 7 months ago

export function saveBlog(data){
    return dispatch => {
        return axios.post('/blog',{
            headers:{
                'Content-Type':'application/json',
            }
        }).then(response=>console.log(data));
    };
}

mlazuardy left a reply on Laravel React Redux Internal Server Error • 7 months ago

i fixed this, forget to use the parameter data to the request

10th March, 2018

mlazuardy started a new conversation Laravel React Redux Internal Server Error • 7 months ago

Currently i want to Increasing my skill in javascript with Laravel as a Backend, but im finding some trouble now. Im making request to Create New blog with React+Redux to manage the form request, my store Controller looks like this

BlogController


    public function store(Request $request)
    {
        $blog = new Blog([
            'title'=> $request->get('title'),
            'body' => $request->get('body'),
            'user_id' => auth()->id()
        ]);
        $blog->save();
        return response($blog,201);
    
    }

and to save the data, using actions.js and connect it to form Component

actions.js

export function saveBlog(data){
    return dispatch => {
        return axios.post('/blog',{
            headers:{
                'Content-Type':'application/json',
            }
        }).then(response=>console.log(data));
    };
}

Form.js

import React from 'react';
import uuid from 'uuid';
import {connect} from 'react-redux';
import {saveBlog} from './actions/blog-action'; 

class NewBlog extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            title:'',
            body:'',
            isLoading:false,
        };
        this.handleChange = this.handleChange.bind(this);
        this.handleSubmit = this.handleSubmit.bind(this);
    }
    handleChange(e){
        this.setState({
            [e.target.name]:e.target.value
        });
    }
    handleSubmit(e){
        e.preventDefault();
        const {title,body,user_id} = this.state;
        this.setState({isLoading:true});
        this.props.saveBlog({title,body,user_id});
        
    }
    render(){
        return(
            <div className="col-md-7" >
                <h2>New Blog</h2>
                <form onSubmit={this.handleSubmit} >
                <input type="hidden" name="_token" value={window.App.csrfToken} />
                    <div className="form-group">
                        <label htmlFor="title">Title</label>
                        <input type="text" onChange={this.handleChange}  value={this.state.title} name="title" className="form-control" />
                    </div>
                    <div className="form-group">
                        <label htmlFor="body">Body</label>
                        <textarea name="body" className="form-control" onChange={this.handleChange} value={this.state.body} cols="30" rows="10"></textarea>
                    </div>
                    <button className="btn btn-primary">{this.state.isLoading ? "Saving..." :"Save" }</button>
                </form>
            </div>
        )
    }
}
export default connect(null,{saveBlog})(NewBlog);

i dont know where im missing because its hard to see the error with Laravel+React

28th February, 2018

mlazuardy left a reply on Design A Requirement Column For Course Table [Database] • 7 months ago

im just thinking like thar sir @bobbybouwmann @ohffs , can i Ask Relevant Question? so if i create course_requirements table. so each time i create course_requirements in forms (with javascript help to add more column to add more requirements). it will save more than 1 record data. How to save multiple data at once?

mlazuardy started a new conversation Design A Requirement Column For Course Table [Database] • 7 months ago

I have a question, Yesterday i buy 1 course from udemy and see the "What We Learn" and "Requirement". while "what we learn" and "requirement" have 1 more than description , for example. Requirement:

  1. you must know PHP
  2. Know About Relationship
  3. bla bla bla

My question is how to design table/column like udemy for showing requirement from database? sorry if you didnt understand cause my bad english

22nd February, 2018

mlazuardy left a reply on Detect Currently Connected USB[php] • 8 months ago

i know that's my bad, this is my first site forum because cant talk in stack overflow . have a bad english. and for some reason i want to know where's the bluetooth detected in android from php code. still finding ..

mlazuardy started a new conversation Detect Currently Connected USB[php] • 8 months ago

I dont know what the provide title should i choose but, my problem is i want to print the connected thermal printer to my android smartphone. first i test to print with linux, and the connected thermal usb printer is "dev/usb/lp0", so what i want to know is what path if i use the android smartphone ? sorry bad english

4th February, 2018

mlazuardy started a new conversation Comparison Between 2 Array [Laravel] • 8 months ago

I Have 1 Array called " social " where this array is listing some social account from my user. I make Social controller like this

   public function socialAccount($username)
    {
        $user = $this->getUserByUsername($username);
        return view('profile.social',compact('user'));

    }

so the view will just listing the array from $username parameter, not all user, for example. My name is Michael, and I just have 1 social account called "facebook". im including 3 socialite provider . facebook, google, and github. So, Michael didnt have google and github,

even my social account is just 1, its still array so i want to make comparison. if i just have facebook social account, then the google and github status will return ` your google and github account is not activated" . So what could i do? make manual array again like

$social = ['google','github','facebook'];

?

sorry for my bad english, i hope you guys understand my problem

27th January, 2018

mlazuardy left a reply on Count All Payments Inside Table • 8 months ago

i want to listing the payments too sir , that's why i make $payments->get(), then the sum of all nominal column, am i wrong? @ehsanquddusi

mlazuardy left a reply on Count All Payments Inside Table • 8 months ago

Thank You Sir, i Modified A little bit to

$payments->sum('nominal');

because already declare like `$payments = Payment::get();

Really thanks :) @ehsanquddusi 

mlazuardy started a new conversation Count All Payments Inside Table • 8 months ago

Too fast too make a question again but, this is the right time to ask something i dont know.

Well, I have a table called 'payments' and inside it, i have 1 column called nominal, where nominal is payment who pay something in my website. the nominal is store the number with bigInteger dataType to store who have pay some money for me. The Question is, how to Count all of total payments of my user payment in nominal column ? for example

user 1 had pay 500 user 2 had pay 7000 user 3 had pay 10000

and all of nominal will count and get equal = 17500.

sorry for bad english, and thank you for helping me

mlazuardy left a reply on Change Carbon Date Format • 8 months ago

i use your 1st option sir, thanks you :) @ejdelmonico

mlazuardy started a new conversation Change Carbon Date Format • 8 months ago

sorry if this question is simple and dumb but. How to change Carbon Date Format when i call a function/helper like $blog->created_at->toFormattedDateString() it show day first, than month and year, not month, day and year. sorry and thank you

24th January, 2018

mlazuardy left a reply on Separated Number With Comma [laravel,javascript] Inside Input Form • 8 months ago

maybe javascript, because i want to bind the data when im start typing @satiseven777

mlazuardy started a new conversation Separated Number With Comma [laravel,javascript] Inside Input Form • 8 months ago

So by default when I or We create an input with type number, and start typing numbers the input is'nt separate the number ( if number > 3 digit ) , for example if we type 3 million it will 3000000, so what i want inside the input field , the 3 million will seperated with comma like 3,000,000 or maybe dot .

How to do that? thank you and sorry bad english

17th January, 2018

mlazuardy left a reply on Restrict User To Write Html Tag In Post Body • 9 months ago

thanks sir :).

16th January, 2018

mlazuardy started a new conversation Restrict User To Write Html Tag In Post Body • 9 months ago

How to restrict or returning to

inside post body with markdown/Rich Text Editor? the problem is, i dont want my user to allow write html, for example. if they use <button>button</button> it will return to <p> again or something else

15th January, 2018

9th January, 2018

mlazuardy left a reply on Request WantsJson Returning To The View [laravel+vue+axios] • 9 months ago

thanks sir oh im too fast too report this problem, its because vue axios must determine if the request wants json, I solve with this.

   mounted(){
          var config = {
              headers:{
                  'Content-Type':'application/json',
                  'Accept':'application/json'
              }
          }
          axios.get('/blog',config).then(response=>{
              this.blogs = response.data;
                console.log(response);
          }).catch(error=>{
              console.log(error);
          });
        
      },

mlazuardy started a new conversation Request WantsJson Returning To The View [laravel+vue+axios] • 9 months ago

I am making 2 request inside 1 method for my json application with Vue+ axios. so i have a BlogController like this

   public function index()
    {   
        $blogs = Blog::with('user')->get();
 
        if (request()->wantsJson()) {
            return $blogs;
        }
        return view('blog.index',compact('blogs'));
      
    }

where this method can i access with url ('/blog'), but when i want to use Vue to get the blog data with axios. it always return to view, and didnt get the data from response.data inside axios. Im already set my Header like this in bootstrap.js

window.axios.defaults.headers.common = {
    'X-CSRF-TOKEN': window.App.csrfToken,
    'X-Requested-With': 'XMLHttpRequest'
};

and also set the header in app.blade.php

 <script>
        window.App = {!! json_encode([
            'csrfToken' => csrf_token(),
            'user' => Auth::user(),
            'signedIn' => Auth::check()
        ]) !!};
    </script>

what's the problem?

7th January, 2018

mlazuardy left a reply on [ASK] If I Make Mobile Application With API • 9 months ago

im still didnt understand to use the permission to/from another application

mlazuardy started a new conversation [ASK] If I Make Mobile Application With API • 9 months ago

maybe this is just a ridicolous question but i just want to know. if im configuring my website with API so any Application outside web can take the resource from my API , the question is. how to Avoid if any other application like android or IoS, cant access the resource ( json) without my permission? should i use passport ? or what? thank you :)

mlazuardy left a reply on What's The Meaning Of Ths [...this.state.data] • 9 months ago

that mean, if i have data in array like name,username,email. So the ...this.state.data will reference to the name, username , and email? @ejdelmonico

6th January, 2018

mlazuardy started a new conversation What's The Meaning Of Ths [...this.state.data] • 9 months ago

in some tutorial of Build App with React js, i see the [...this.state.data] inside the function like handleAddTodo. what's the meaning of that?

5th January, 2018

mlazuardy started a new conversation Updating State From MainClass [ReactJS] • 9 months ago

So this is my First Time using React JS as front end. first . I Have main Class of my Video table called MainVideo.js and the code is look like this.

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import axios from 'axios';
import AddVideo from './AddVideo';
import VideoRow from './VideoRow';

class MainVideo extends Component{
    constructor(){
        super();
        this.state = {
            videos:[]
        }
    }
    componentDidMount(){
        axios.get('/video')
        .then(response=>{
            this.setState({ videos: response.data});
        })
        .catch(error=>{
            console.log(error);
        });
    }
    videoRow(){
        if(this.state.videos instanceof Array){
            return this.state.videos.map(video=>{
                return <VideoRow video={video} key={video.id}/>
            });
        }
    }
    render(){
        return(
            <div className="container margin-top-60 text-center">
                <div className="row">
                    <h1>MyVideo</h1>
                    <div className="col-md-8 col-md-offset-2">
                        <AddVideo videos={this.state.videos} />
                    </div>
                    {this.videoRow()}
                </div>
            </div>
        );
    }
}
if(document.getElementById('main-video')){
    ReactDOM.render(<MainVideo/>,document.getElementById('main-video'));
}

as you guys see im adding two class again for adding video and showing Data for my videos. my data video called VideoRow look like this:

import React, { Component } from 'react';

export default class VideoRow extends Component {

    render() {
        return (
            <div className="col-md-8 col-md-offset-2">
                <div className="panel panel-default">
                    <div className="panel-heading">{this.props.video.title}</div>
                    <div className="panel-body">
                        <p>{this.props.video.content}</p>
                    </div>
                </div>
            </div>
        );
    }
}

and the AddVideo.js

import React, { Component } from 'react';
import axios from 'axios';
import swal from 'sweetalert';

export default class AddVideo extends Component {
    constructor(props){
        super(props);
        this.state = {

            title:'',
            content:'',
        }
        this.handleChange = this.handleChange.bind(this);
        this.handleSubmit = this.handleSubmit.bind(this);
    }
    // componentDidMount(){
    //     axios.get('/video').then(response=>{
    //         this.setState({videos:response.data});
    //     })
    // }
    handleChange(e){
        const target = e.target;
        const value = target.value;
        const name  = target.name;
        this.setState({
            [name]:value
        });
    }
    handleSubmit(e){
        e.preventDefault();
        if(!this.state.title.length){
            alert('whoops');
        }
        else if(!this.state.content.length){
            alert('whaaaps');
        }
        const newVideo = {
            title:this.state.title,
            content:this.state.content,
            user: window.App.user.id,
        };
        let uri = 'http://localhost:8000/video';
        axios.post(uri,newVideo).then(response=>{
            swal({
                title:"success",
                text:'want add video again?',
                icon:"success"
            });
        }).then(response=>{
            this.setState(prevState=>({
                title:'',
                content:'',
                id:Date.now(),
            }));
        })
    }

    render() {
        return (
            <form onSubmit={this.handleSubmit} >
                <div className="form-group">
                    <label htmlFor="title">Title</label>
                    <input type="text" onChange={this.handleChange} name="title" value={this.state.title} className="form-control"/>
                </div>
                <div className="form-group">
                    <label htmlFor="content">Content</label>
                    <textarea id="" cols="30" rows="10" name="content" onChange={this.handleChange} value={this.state.content} className="form-control"/>
                </div>
                <div className="form-group">
                    <button className="btn btn-primary">Add Video</button>
                </div>
            </form>
        );
    }
}

what i want is. the AddProduct will automatically Render when i press Submit in the button, where the submit button is handle by handleSubmit, without reloading the page again. im trying concating the data but it need to reload the page to show new Data from handleSubmit function.

The question is, how to when click handleSubmit the new data will automatically add to the MainVideo.js , sorry and thank you

mlazuardy left a reply on [ASK] Hiding API And Json Response With • 9 months ago

thank you sir i'll make changes now. and summary is . still secure right? @lostdreamer_nl

mlazuardy left a reply on [ASK] Hiding API And Json Response With • 9 months ago

you're right about $blogs->count but. i want to user who insert url manually to become 404. since the returning method just want JSON format. i mean if i enter localhost:8000/api/blog from browser, it will become 404 . or maybe return to the main page again like api/user from default laravel out of the box @lostdreamer_nl

4th January, 2018

mlazuardy started a new conversation [ASK] Hiding API And Json Response With • 9 months ago

I created an API using two controllers, one is in API \ BlogController and the other is in BlogController. I use this way so that the response from JSON can not be accessed through the page, and only in access if the response wants a JSON format. API \ My BlogController is like this

Api\BlogController.php

   public function index()
    {
        $blogs = Blog::with('category','user')->latest()->where('status', 'PUBLISHED')->paginate(9);
        $categories = Category::get();
        if(!$blogs){
            abort(404);
        }
        if(!request()->wantsJson()){
            abort(404);
        }
        return response()->json($blogs,200);
    }

the question is, is my method vulnerable or not?

mlazuardy left a reply on Stripped Tags On Live Server • 9 months ago

or if my answer is not your expectation. show me some image or code to help you fix that

mlazuardy left a reply on Stripped Tags On Live Server • 9 months ago

its easy i think. dont use {{$blog->body}} but use {!!$blog->body!!} @OshJones

3rd January, 2018

mlazuardy left a reply on Save Image/file Naming • 9 months ago

you're the best sir thank you it work now. Thank you again and sorry for making you angry @Snapey

2nd January, 2018

mlazuardy left a reply on Blank Page [Vue+laravel] • 9 months ago

Finally, this fix with <code v-pre>

mlazuardy left a reply on [ASK] Make More Than 1 <Root> Element [Vue] • 9 months ago

@tykus honestly, i'm in trouble with that. if you want to know you can go to here https://laracasts.com/discuss/channels/vue/blank-page-vuelaravel

but thanks sir :D

mlazuardy left a reply on [ASK] Make More Than 1 <Root> Element [Vue] • 9 months ago

do you mean app.js ? @tykus ? hehe :D thank you sir. i have some problem implementing global Root to whole my page. and so i want to make another instance

so if i make #app-1 and it cant communicate to #app-2 ? i guess that's not problem, because i didnt want to use vue js in my whole page. @lostdreamer_nl

mlazuardy left a reply on Save Image/file Naming • 9 months ago

should i have to repeat the reply before? @Snapey ,

$ext = $request->file('image')->extension();

$filename = $request->file('image')->storeAs('public/blogs/', 'post' . $post->id . '.' . $ext);

$blog->image = $filename;

this is the code before. image column in blogs table is store public/blogs/blog.jpg., and this is the wrong path to use helper in blade like

src="{{url('storage/'.$blog->image)}}

Because, the url helper is located in public folder. so image is return 404 because the if i inspect that in chrome. the full path url to the image is localhost/storage/public/blogs. that's wrong. i didnt have public/blogs folder inside public folder. i just have directory/public/storage/blogs/blog.jpg

mlazuardy started a new conversation [ASK] Make More Than 1 <Root> Element [Vue] • 9 months ago

Can we make more than 1 root element? for example. By default in Laravel Framework , Vue will generate the element in #app, but can I delete that, and make costum id for each element that i want to impelement vue like this.

<div id="app-2"><example></example></div>

and i have another id

<div id="app-3">
    <example-2></example-2>
</div>

Can i ?

Edit Your Profile
Update

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