I want to check what value has column in another table and based on that value to save in current table. Here is the controller so you can get what I mean
$preference = Preferences::pluck('preferences_is_active');
$book = new book;
$book->book_description = Input::get('description');
$book->book_title = Input::get('title');
$book->user_id = Auth::user()->id;
if($preference !== 0) {
$book->book_published = 0;
$book->save();
}
return Redirect::to('/users/books');
So I want user to be able to save new books' information in his profile. But also want to check column preferences_is_active
in table preferences
and do the conditions.
The problem is that no matter what value has preferences_is_active
it's always saves 0
in books
table. What I miss here?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2xJIzJF
via IFTTT
Aucun commentaire:
Enregistrer un commentaire