Laravel

Laravell Image Quality

Every time i upload a new image to my server, this image is resized. The main issue im having is that the image is losing a lot of quality. This is the current code: $name1 = str_random(10); $img = Image::make($img1); $img->resize(270,152, function ($constraint) {$constraint->aspectRatio();}); $img->crop(160, 132, 55, 0); $img->save(‘/imagenes/’.$name1.’.jpg’, 100); $escena->img1_plx = $name1.’.jpg’; I tried with different changes but the…
Read more

Forwarding the `store` method to the `update` method

I am trying to forward store request to update meth when its possible. I trying something similar to below: public function store(UserRequest $request) { return $this->update(new User, $request); } public function update(User $user, UserRequest $request) { // code } However, it seems the first parameter of update need an already in database user and the above code does not work…
Read more

Laravel5 file Upload via Ajax

When I am uploading file showing some error. Error details and file contents are given below. Could you please check and help me to solve this issue? Error Whoops, looks like something went wrong. MethodNotAllowedHttpException in RouteCollection.php line 201: in RouteCollection.php line 201 at RouteCollection->methodNotAllowed(array(‘GET’, ‘HEAD’)) in RouteCollection.php line 188 at RouteCollection->getRouteForMethods(object(Request), array(‘GET’, ‘HEAD’)) in RouteCollection.php line 140 at RouteCollection->match(object(Request))…
Read more

Is it ok to work in Laravel and CodeIgniter side way? Will it kill my learning curve and total mess up?

I am total noob to frameworks, I have been doing everything in raw Php codes only. DB call, authentication, everything using raw phpcodes, but now the time comes for using a phpframework, since I got a new project, its an SMB project, mostly doing administration, reports, lists etc. I was searching and reading a lot of laravel vs CodeIgniter debates…
Read more

Tracing the authenticated() method in the deault laravel auth functionality

I am currently using this method to provide a flash message to a user after a user logged in. This is using the default auth functionality of laravel(5.1). Somebody suggested my to use this method in my AuthController to override the default one. public function authenticated(Request $request, User $user ) { // Succes flash message alert()->success(‘Succesvol ingelogd’, ‘Welkom’); return redirect()->intended(…
Read more

str_replace emoticons Laravel

I want to replace text with emoticons. The problem is that I don’t know how to replace a lot of them. At this time I have this code which is working: <p>{!! str_replace(‘:D’, ‘<img src=”/emoticons/grin.png” alt=””>’, $post->content) !!}</p> So when I write ‘:D’, the emoticon is working fine, but I don’t know how to add more emoticons. Any help appreciate….
Read more

Adding an Error Title and Message to JSON in PHP (Laravel)

$rules = [’email’ => ‘required’, ‘password’ => ‘required’]; $message = [’email.required’ => ‘Email cannot be empty’, ‘password.required’ => ‘Password cannot be empty’]; $v = Validator::make($request->all(), $rules, $message); $error = $v->messages(); if ($v->fails()) { return response()->json([“code” => “400”, “error” => [“code” => “10”, “title”=>”” ,”message” => $error->first() ]]); } The code above would return an error block in my JSON error…
Read more