PostController: public function createpost(Request $request) {
Post::create(
[
'user_id'=>$request->user_id,
'post_title'=>$request->post_title,
'post_body'=>$request->post_body,
'post_image'=>$request->file('post_image')->store('public'),
'status'=>1
]);
echo "Recorded Successfully";
echo "<a href='/post'>Click here</a> to go back";
}
Filesystems.php 'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
Blade.php file
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire