infinitanet

Experience

640

0 Best Reply Awards

  • Member Since 2 Years Ago
  • 3 Lessons Completed
  • 1 Favorite

15th September, 2017

infinitanet left a reply on What Is The Correct Way To Change More Than One Data In The Database (Order)? • 2 months ago

@sutherland I had thought so, but my language is Portuguese.   It would be very confusing for you to understand (Google translate).

  Thanks for the answers.

14th September, 2017

infinitanet started a new conversation What Is The Correct Way To Change More Than One Data In The Database (Order)? • 2 months ago

Hello, I have an "order" column, this order is the count to sort my articles in homepage.   If I have 3 articles, I'll add an article as the first item. Should I create a tie similar to this?

Before: id 1 | Article example | order 1 id 2 | Article example | order 2 id 3 | Article example | order 3

After: id 1 | Article example | order 1 id 2 | Article example | order 2 id 4 | Article example | order 3 id 3 | Article example | order 4

Code: $toChange = Article::where('order', '>=',3)->get(); foreach($toChange as $item) { $item->update(['order'= $item->order +1]); }

This works, but is this really a good practice?

  Thank you!

31st March, 2017

infinitanet left a reply on Cloudflare Not Work With Laravel • 7 months ago

Change to Flexible (option in CloudFlare) is work.

infinitanet started a new conversation Cloudflare Not Work With Laravel • 7 months ago

Hello, how are you? SSL Cloudflare to work. When I leave without SSL, my site works normal.   When I enable HTTPS: //, "Error 521: Web server is down" appears.

  I read the Cloudflare article, it tells me that this problem is in connecting the server (my) with Cloudflare.

  Should I free some port on my Cloud?

  Thank you!

15th December, 2016

infinitanet left a reply on Authorization (GATE) Does Not Work On My Laravel 5.3 • 11 months ago

This is true, I think it is not possible to use direct in the constructor.

  I'll look for an alternative to block administrator.

infinitanet started a new conversation Authorization (GATE) Does Not Work On My Laravel 5.3 • 11 months ago

Thanks for listening.   I can not understand why my "admin-login" rule does not work.   She works on Laravel 5.2.

AuthServiceProvider:

19th October, 2016

infinitanet left a reply on First Item In Laravel 5.3 Relationships • 1 year ago

Thanks!

This code Work!

$recommend->first_image['name'];

Thank you very much.

infinitanet started a new conversation First Item In Laravel 5.3 Relationships • 1 year ago

Hello, how do I get the first item of the relationship (Relationship: Product and Product Images).   I have in my Model: public function getFirstImageAttribute() { return $this->hasMany('CodeCommerce\ProductImage')->first(); }

In my view: $featured->firstImage->name

This code return (2 items): [%7B"id":1,"name":"kh8QsPxpIS.jpg","product_id":"34","created_at":"2016-10-20%2000:53:21","updated_at":"2016-10-20%2000:53:21"%7D,%7B"id":2,"name":"tWFoMOlZ6g.jpg","product_id":"34","created_at":"2016-10-20%2001:32:47","updated_at":"2016-10-20%2001:32:47"%7D]

I'm sorry ignorance, I am new to Laravel and I am struggling to get the first item.

9th August, 2016

infinitanet left a reply on How To Clone Files Sent Via Form? • 1 year ago

True, I had not thought of that.

  Thanks for listening!

infinitanet left a reply on How To Clone Files Sent Via Form? • 1 year ago

This code work:

    $file = $request->file('photo');
    $image_name_final = $file->getClientOriginalName();
    $image_name = $image_name_final;

    $folder = 'assets/uploads/thumbs/';
    $file->move($folder,$image_name);

    $folder1 = 'assets/uploads/thumbs/675/';
    copy($folder.$image_name,  $folder1.$image_name);
    Image::make(sprintf('assets/uploads/thumbs/675/%s', $image_name))->resize(675, 340)->save();

    $folder2 = 'assets/uploads/thumbs/450/';
    copy($folder.$image_name,  $folder2.$image_name);
    Image::make(sprintf('assets/uploads/thumbs/450/%s', $image_name))->resize(450, 341)->save();

    $folder3 = 'assets/uploads/thumbs/770/';
    copy($folder.$image_name,  $folder3.$image_name);
    Image::make(sprintf('assets/uploads/thumbs/450/%s', $image_name))->resize(770, 385)->save();

infinitanet left a reply on How To Clone Files Sent Via Form? • 1 year ago

OMG,

copy($folder.$image_name, $folder2.$image_name);

This code = sucess.

Thank U!

infinitanet left a reply on How To Clone Files Sent Via Form? • 1 year ago

Hello Simondavies.

BadMethodCallException in Macroable.php line 74: Method copy does not exist.

not work :-)

infinitanet started a new conversation How To Clone Files Sent Via Form? • 1 year ago

Hello, I'm doing a CRUD for articles of a site.   I need to clone the image field of the image ($ request-> file ('photo')).

  How do I clone the photo?

  I tried for 1 hour and did not get to completion in an efficient manner.   Thank you!

public function store(Request $request)
{
    $file = $request->file('photo');

    $folder1 = 'assets/uploads/thumbs/675/';
    $folder2 = 'assets/uploads/thumbs/450/';
    $image_name = $file->getClientOriginalName();

    $cp1 = $file->move($folder1,$image_name);
    $cp2 = $file->move($folder2,$image_name);
    $image1 = Image::make(sprintf('assets/uploads/thumbs/675/%s', $image_name))->resize(675, 340)->save();

    Storage::copy(public_path().'/assets/uploads/thumbs/675/bg2.jpg', public_path().'/assets/uploads/thumbs/450/bg2.jpg');

}

This code not work :-(

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.