hate

5841 经验值

权限是有的 ,无法写入未定义路径,我dd($photo)那个地址我在游览器打开就能看到图片

$photo =$request->get('photo');

    $width  =  (int)$request->get('w');
    $height =  (int)$request->get('h');
    $xAlign =  (int)$request->get('x');
    $yAlign =  (int)$request->get('y');

    Image::make($photo)->crop($width,$height,$xAlign,$yAlign)->save();
    $user  = \Auth::user();

    $user->avatar = $request->get('photo');

    $user->save();

    return redirect('users/avatar');

$photo 的值是"http://localhost/community/public/uploads/32_1498146253zhuomian.jpg"
无法写入未定义路径是什么鬼

已经解决:

少了一个属性:enctype="multipart/form-data"

$file = $request->file('avatar');

    $destinationPath = 'uploads/';
    $filename = $file->getClientOriginalName();
    dd($filename);

报错如下:
Call to a member function getClientOriginalName() on null

好像是这么一回事。我直接用 protected $guarded = array();

Whoops, looks like something went wrong.

1/1
MassAssignmentException in Model.php line 424:
discussion_id

    Comment::create(array_merge($request->except('_token'),['user_id'  => \Auth::user()->id,'discussion_id' => $request->get('discussion_id')]));

class Comment extends Model
{

protected $fillabele = ['body','user_id','discussion_id'];
public function user()
{
    return $this->belongsTo(User::class);
}

public function discussion()
{
    return $this->belongsTo(Dicussion::class);  
}

}

class CommentsController extends Controller
{



public function store(Requests\PostCommentRequest $request)
{
    dd($request->all());
    Comment::create(array_merge($request->all(),['user_id'  => \Auth::user()->id]));

    return redirect()->action('PostsController@show',['id' => '2']);
}

}
在这里create 页面报__token