Ajax request and Auth::user()

Posted 3 years ago by randomsheep

I have a post system, where i want use a ajax. But, there i have a little problem.

$post = new Post;
$post->title = Input::get('title', 'N/A');
$post->content = Input::get('content');
$post->author = Auth::user()->id;

So, this doesn't work when i use ajax.. I mean: On Ajax call, with Auth::user()->id, jQuery gets a 500 error, but without Auth::user.... working perfectly. How i can solve this problem?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.