Support the ongoing development of Laravel.io →
Database Forms Validation
Last updated 1 year ago.
0

Use bellow code for store image in public Directory with resize image and image path store in database field.

   $input           = Input::all();
   $file            = array_get($input, 'image');
   $destinationPath = public_path('images');
   $fileName        = $request->image->getClientOriginalName();
   $imageResize     = Image::make($file->getRealPath())
                   ->resize(50,50,function($c){$c->aspectRatio(); $c->upsize();})->save($destinationPath.'/'.$fileName);  
   $filepath        = $destinationPath.'/'.$path;

   $insert = array('username' => Input::get('username'),
                   'image'    => $filepath,
                   );
    
    DB::table('users')->insert($insert);

Hope, this work for you.

Last updated 6 years ago.
0

Its not even entering into store function after user registers.I have used the existing RegisterController.php which comes in make:auth of laravel [app\Http\Controllers\Auth\RegisterControl‌​ler.php] and defined store function there. when user register in the form[register.blade.php], the action called is-> action="{{ route('register') }}".after the user clicks submit ,it enters into RegisterController to validate user information. My questions is whether we can write functions inside laravel auth\RegisterControl‌​ler.php. In Router.php :

  // Registration Routes...
        $this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
        $this->post('register', 'Auth\RegisterController@register');

if I add my store function, it doesn't execute.


So, I tried writing my store function inside \vendor\laravel\framework\src\Il‌​luminate\Foundation\‌​Auth\RegistersUsers.‌​php=>which uses trait RegistersUsers. 

The output in  http://localhost:8000/register/store ""Sorry, the page you are looking for could not be found.NotFoundHttpException in RouteCollection.php line 179:"

How to proceed further.
Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sweetyr sweetyr Joined 17 Apr 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.