how to access the current page id in vue js and laravelHow can I prevent SQL injection in PHP?How do I check if a string contains a specific word?Laravel won't use bladesvue.js 2.0 load component dynamically in laravel 5.3Vuejs 2 with Laravel 5.4 backend, post (Unauthorized) errorImport Vue Component only when added to blade pagesRouting on Vue with SSR and Laravelaccess method outside vue componentHow to combine laravel and vue routesHow to extend new Vue() in blades files
Inward extrusion is not working
Prime Sieve and brute force
Is a lack of character descriptions a problem?
With Ubuntu 18.04, how can I have a hot corner that locks the computer?
Is it possible to have a wealthy country without a middle class?
Pre-1972 sci-fi short story or novel: alien(?) tunnel where people try new moves and get destroyed if they're not the correct ones
Arriving at the same result with the opposite hypotheses
Is it legal for a bar bouncer to confiscate a fake ID
Zeros of the Hadamard product of holomorphic functions
Is this use of the expression "long past" correct?
Generate basis elements of the Steenrod algebra
Mathematically, why does mass matrix / load vector lumping work?
Need feedback - Can the composition/colors of this design be fixed if something is lacking or is not a better fit?
Are there any important biographies of nobodies?
Winning Strategy for the Magician and his Apprentice
How does an ordinary object become radioactive?
Is an entry level DSLR going to shoot nice portrait pictures?
Meaning of 'lose their grip on the groins of their followers'
Union with anonymous struct with flexible array member
Is it a problem if <h4>, <h5> and <h6> are smaller than regular text?
How do I prevent employees from either switching to competitors or opening their own business?
Compiling C files on Ubuntu and using the executable on Windows
What can I, as a user, do about offensive reviews in App Store?
Rebus with 20 song titles
how to access the current page id in vue js and laravel
How can I prevent SQL injection in PHP?How do I check if a string contains a specific word?Laravel won't use bladesvue.js 2.0 load component dynamically in laravel 5.3Vuejs 2 with Laravel 5.4 backend, post (Unauthorized) errorImport Vue Component only when added to blade pagesRouting on Vue with SSR and Laravelaccess method outside vue componentHow to combine laravel and vue routesHow to extend new Vue() in blades files
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
i am working on a blog with laravel and vuejs and i have written the comment part as a vuecomponent and inserted that in show function of my post like this
@section('content');
.
.
.
<comment></comment>
@endsection
where above i show the single post and the comment section below it .now i want to access 2 things 1-the user id who enters the comment and the more important the id of the post which the user is currently seeing in my case for example its
http://localhost:8000/blog/8
that number 8 . as far as i cant use blade and php in vue component how should i access them in vue component .
php laravel vue.js
add a comment |
i am working on a blog with laravel and vuejs and i have written the comment part as a vuecomponent and inserted that in show function of my post like this
@section('content');
.
.
.
<comment></comment>
@endsection
where above i show the single post and the comment section below it .now i want to access 2 things 1-the user id who enters the comment and the more important the id of the post which the user is currently seeing in my case for example its
http://localhost:8000/blog/8
that number 8 . as far as i cant use blade and php in vue component how should i access them in vue component .
php laravel vue.js
add a comment |
i am working on a blog with laravel and vuejs and i have written the comment part as a vuecomponent and inserted that in show function of my post like this
@section('content');
.
.
.
<comment></comment>
@endsection
where above i show the single post and the comment section below it .now i want to access 2 things 1-the user id who enters the comment and the more important the id of the post which the user is currently seeing in my case for example its
http://localhost:8000/blog/8
that number 8 . as far as i cant use blade and php in vue component how should i access them in vue component .
php laravel vue.js
i am working on a blog with laravel and vuejs and i have written the comment part as a vuecomponent and inserted that in show function of my post like this
@section('content');
.
.
.
<comment></comment>
@endsection
where above i show the single post and the comment section below it .now i want to access 2 things 1-the user id who enters the comment and the more important the id of the post which the user is currently seeing in my case for example its
http://localhost:8000/blog/8
that number 8 . as far as i cant use blade and php in vue component how should i access them in vue component .
php laravel vue.js
php laravel vue.js
asked Mar 24 at 18:13
FarshadFarshad
376215
376215
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There are quite a number of things you need to do.
First, if you aren't doing that already, you need send the value of the single post and the user from your controller. You can then access it in the blade file. This post might help
Next, you should pass the post_id and user_id as props to the component like so:
<comment post_id="$post->id" user_id="$user->id"></comment>
Lastly, make sure you register the props in your 'comment' component:
props: ['post_id', 'user_id']
that was really time saver thanks it helped alot :)
– Farshad
Mar 24 at 19:24
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326941%2fhow-to-access-the-current-page-id-in-vue-js-and-laravel%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are quite a number of things you need to do.
First, if you aren't doing that already, you need send the value of the single post and the user from your controller. You can then access it in the blade file. This post might help
Next, you should pass the post_id and user_id as props to the component like so:
<comment post_id="$post->id" user_id="$user->id"></comment>
Lastly, make sure you register the props in your 'comment' component:
props: ['post_id', 'user_id']
that was really time saver thanks it helped alot :)
– Farshad
Mar 24 at 19:24
add a comment |
There are quite a number of things you need to do.
First, if you aren't doing that already, you need send the value of the single post and the user from your controller. You can then access it in the blade file. This post might help
Next, you should pass the post_id and user_id as props to the component like so:
<comment post_id="$post->id" user_id="$user->id"></comment>
Lastly, make sure you register the props in your 'comment' component:
props: ['post_id', 'user_id']
that was really time saver thanks it helped alot :)
– Farshad
Mar 24 at 19:24
add a comment |
There are quite a number of things you need to do.
First, if you aren't doing that already, you need send the value of the single post and the user from your controller. You can then access it in the blade file. This post might help
Next, you should pass the post_id and user_id as props to the component like so:
<comment post_id="$post->id" user_id="$user->id"></comment>
Lastly, make sure you register the props in your 'comment' component:
props: ['post_id', 'user_id']
There are quite a number of things you need to do.
First, if you aren't doing that already, you need send the value of the single post and the user from your controller. You can then access it in the blade file. This post might help
Next, you should pass the post_id and user_id as props to the component like so:
<comment post_id="$post->id" user_id="$user->id"></comment>
Lastly, make sure you register the props in your 'comment' component:
props: ['post_id', 'user_id']
answered Mar 24 at 18:59
Mofope OjoshMofope Ojosh
262
262
that was really time saver thanks it helped alot :)
– Farshad
Mar 24 at 19:24
add a comment |
that was really time saver thanks it helped alot :)
– Farshad
Mar 24 at 19:24
that was really time saver thanks it helped alot :)
– Farshad
Mar 24 at 19:24
that was really time saver thanks it helped alot :)
– Farshad
Mar 24 at 19:24
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326941%2fhow-to-access-the-current-page-id-in-vue-js-and-laravel%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown