I use laravel 5.6 and I'm beginner in this framework, I want to stock in my database in publicite table "name","path","url" of all publicites, I make a modal and controller and I add my controller to api.php in route and I get this error
Too few arguments to function App\Http\Controllers\PubliciteController::stockpath(), 0 passed and exactly 1 expected
this is my controller : "PubliciteController":
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\publicite;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Exceptions\TokenInvalidException;
use Config;
use Artisan;
class PubliciteController extends Controller
{
//enregistre les path des images
public function stockpath ($request){
$input = $request->all();
$validator = Validator::make($input, [
'name'=> 'required',
'url'=> 'required',
'path'=> 'required'
] );
if ($validator -> fails()) {
# code...
return $this->sendError('error validation', $validator->errors());
}
$ads = ads::create($input);
return $this->sendResponse($ads->toArray(), 'Ads created succesfully');
}
}
this is my model publicite:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Publicite extends Model
{
protected $fillable = [
'name','url', 'path',
];
}
and this is my route:
Route::post('publicite', 'PubliciteController@stockpath');
where is it my falut , what's exepected I use post man and I get this error