I am trying to get the id of the current user on my controller this way
$post->user_id=Auth::user()->id;
I'm importing these classes
use Illuminate\Http\Request;
use conocermusica\Post;
use Illuminate\Support\Fecades\Redirect;
use conocermusica\Http\Requests\PostFormRequest;
use DB;
when I add:
use Auth;
I get the error
(1/1) FatalThrowableError Class 'Illuminate\Support\Fecades\Redirect' not found
How can I resolve this?
Your import is wrong:
The path is Illuminate\Support\Facades\Redirect
.
You should try this:
use Illuminate\Support\Facades\Redirect;
OR
use Redirect;
Like the others said you path is misspelled.
It should be :
use Illuminate\Support\Facades\Redirect;
Also you have a shorter way to get the user id with Auth::id()
instead of Auth::user()->id