Arturo

Web developer at Marival Group

Experience

43,590

0 Best Reply Awards

  • Member Since 3 Years Ago
  • 572 Lessons Completed
  • 19 Favorites

15th August, 2017

Arturo started a new conversation Help For Iterate JSON • 3 months ago

Hello everyone, I have converted an xml to json and I have this result:

available:6
seats:Array[26]
0:Object
@attributes:Object
id:"A"
Lugar:Array[25]
1:Object
@attributes:Object
id:"B"
Lugar:Array[25]

I need access through the id @attributes object but I can't

any help ?

28th July, 2017

Arturo left a reply on Using Web Service And Auth? • 3 months ago

solution?

22nd May, 2017

Arturo started a new conversation Traslatable Pivot Table • 6 months ago

Hi everyone,

I have an issue with this package dimsav/laravel-translatable i need to translate an attribute in to the pivot table

some advice?

4th April, 2017

Arturo left a reply on Setting Attribute On New User Registration • 7 months ago

add to fillabe array sid

$fillable = [ 'name', 'email', 'password','sid' ];

31st March, 2017

Arturo left a reply on View Composer Problem • 7 months ago

I need pass a variable to the view composer to load a specific behavior

Arturo started a new conversation View Composer Problem • 7 months ago

I need to pase a colletion to a view composer from my controller

my controller

$navigationComposer = new \App\Marivalaccess\ViewComposers\NavigationComposer( $page);

     $navigationComposer->compose();

but I have this error Argument 1 passed to App\ViewComposers\NavigationComposer::compose() must be an instance of Illuminate\View\View, none given

if I delete View from the method compose I resive the object but i cant see the view

 public function compose(View $view) //<- the error
{
}

any ideas?

10th March, 2017

Arturo left a reply on Just A Few Things From My Point Of View :) • 8 months ago

i Have the same issues

1st March, 2017

Arturo left a reply on Change Keys To Collection • 8 months ago

Thanks, I defined other key (media) for the results, i dont know if is a good practice

$data = $pages->map(function($page) {

    $page->media = $page->files->keyBy('position');
    return $page;
});

Arturo left a reply on Change Keys To Collection • 8 months ago

I cant see reflected the results in the array

$data = $pages->map(function($page) {

    $page->files = $page->files->keyBy('position');
    return $page;
});
dd($data->toArray());

"files" => array:2 [▼
      0 => array:10 [▼
        "id" => 71
        "page_id" => "13"
        "path" => "/frontend/media/13/residences.jpg"
        "type" => "image/jpeg"
        "status" => "1"
        "position" => "3"
        "locale" => "both"
        "updated_at" => "2017-02-28 22:28:48"
        "created_at" => "2017-02-28 22:28:23"
        "order" => null
      ]
      1 => array:10 [▼
        "id" => 73
        "page_id" => "13"
        "path" => "/frontend/media/13/logo-residences.png"
        "type" => "image/png"
        "status" => "1"
        "position" => "4"
        "locale" => "both"
        "updated_at" => "2017-02-28 22:32:14"
        "created_at" => "2017-02-28 22:32:02"
        "order" => null
      ]
    ]

28th February, 2017

Arturo left a reply on Change Keys To Collection • 8 months ago

by te position

"position" => "3",

"position" => "4"

Arturo started a new conversation Change Keys To Collection • 8 months ago

Hi, I have one question I try to find the method but i cant get answere.

I need to change the keys for files collection

this is my collection

$pages = \App\Page::with('files')->get()

array:2 [▼
  0 => array:17 [▼
    "id" => 13
    "parent_id" => "16"
    "category_id" => "3"
    "order" => "24"
    "updated_at" => "2017-01-26 22:16:47"
    "created_at" => null
    "menu" => "0"
    "category" => array:8 [▶]
    "files" => array:2 [▼
      0 => array:10 [▼
        "id" => 71
        "page_id" => "13"
        "path" => "/frontend/media/13/residences.jpg"
        "type" => "image/jpeg"
        "status" => "1"
        "position" => "3"
        "locale" => "both"
        "updated_at" => "2017-02-28 22:28:48"
        "created_at" => "2017-02-28 22:28:23"
        "order" => null
      ]
      1 => array:10 [▼
        "id" => 73
        "page_id" => "13"
        "path" => "/frontend/media/13/logo-residences.png"
        "type" => "image/png"
        "status" => "1"
        "position" => "4"
        "locale" => "both"
        "updated_at" => "2017-02-28 22:32:14"
        "created_at" => "2017-02-28 22:32:02"
        "order" => null
      ]
    ]
    "status" => "1"
    "locale" => "en"
  ]
  1 => array:17 [▶]
]

in the files I need to changes the keys to the position like

array:2 [▼
  0 => array:17 [▼
   
    "files" => array:2 [▼
      3 => array:10 [▼
        "id" => 71
        "page_id" => "13"
        "path" => "/frontend/media/13/residences.jpg"
        "type" => "image/jpeg"
        "status" => "1"
        "position" => "3"
        "locale" => "both"
        "updated_at" => "2017-02-28 22:28:48"
        "created_at" => "2017-02-28 22:28:23"
        "order" => null
      ]
      4 => array:10 [▼
        "id" => 73
        "page_id" => "13"
        "path" => "/frontend/media/13/logo-residences.png"
        "type" => "image/png"
        "status" => "1"
        "position" => "4"
        "locale" => "both"
        "updated_at" => "2017-02-28 22:32:14"
        "created_at" => "2017-02-28 22:32:02"
        "order" => null
      ]
   
]

any ideas?

26th January, 2017

Arturo left a reply on Some Ideas For Route Wildcard? • 9 months ago

LOL, thanks for your opinion, I try to figure it out how handler this issue

in the routeServiceprovider

public function map()
    {
        $this->mapBackendRoutes();

        $this->mapApiRoutes();
        
        $this->mapWebRoutes();
    }

    
    protected function mapBackendRoutes()
    {
        Route::prefix('admin')
             ->middleware('auth')
             ->middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/backend.php'));
    }

    protected function mapWebRoutes()
    {
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/web.php'));
    }

the backend routes are as ussual stuff

Route::resource('users', 'Backend\UserController',
    ['names'=>[
        'index'     =>  'backend.user.index',
        'create'    =>  'backend.user.create',
        'edit'      =>  'backend.user.edit',
        'destroy'   =>  'backend.user.destroy',
        'update'    =>  'backend.user.update',
        'store'     =>  'backend.user.store'
    ]]
);

I have handle all the uri in the routes becouse is the identifier of every page in the database, my frontend routes

Route::get('/', 'Frontend\[email protected]');
Route::get('{slug}/{slug2?}/{slug3?}/{slug4?}/{slug5?}', 'Frontend\[email protected]');

Arturo started a new conversation Some Ideas For Route Wildcard? • 9 months ago

I have this route ''' Route::get('{slug}/{slug2?}/{slug3?}/{slug4?}/{slug5?}', 'Frontend\[email protected]'); ''' and in the router I find the page by the permalink like this

PageController.php ''' public function __construct(Request $request, PageService $page) { $this->current = $request->path(); $this->page = $page; }

public function router()
{
    
    $detail = $this->page->getPage($this->current =='/'?'/':'/'.$this->current);

     return view('frontend.pages.'.$detail->page->category->permalink)->with('detail', $detail);
}

'''

But i have some comflicts with the backend routes, any ideas to send al the uri with the route only for the front end

20th January, 2017

Arturo started a new conversation Artisan Error • 10 months ago

I have this error when I install laravel:

Script php artisan optimize handling the post-update-cmd event returned with error code 255

only with php 7.0 and 7.1, with php 5 runs ok

and I try to run php artisan but nothing happens

any ideas?

5th January, 2017

Arturo left a reply on Laravel Development Environment On MAC? • 10 months ago

I use ampps and its free

1st December, 2016

Arturo left a reply on SQLSTATE[42000]: Syntax Error Or Access Violation Isn't In GROUP BY • 11 months ago

@Rocky you resolved your problem? I have the same issue

19th November, 2016

Arturo left a reply on Pluck Collection Keys • 1 year ago

thanks a lot, a only ad the key 0 to display results

class ParentExtractor
{
    protected $rows;

    protected $results;

    public function __construct($rows)
    {
        $this->rows = $rows;
        $this->results = collect();
    }

    public function handle()
    {

        $this->results->push($this->rows[0]['parent_id']);

        $this->parent_id($this->rows[0]['parent']);

        return $this->results->flatten()->all();
    }

    protected function parent_id($array)
    {
        $items = collect($array);

        $this->results->push($items->pluck('parent_id'));

        $items->each(function($item) {
            if (count($item->parent)) {
                $this->parent_id($item->parent);
            }
        });
    }

}

18th November, 2016

Arturo left a reply on Pluck Collection Keys • 1 year ago

thanks

{"id":41,"parent_id":"40","category_id":"13","order":"24","status":null,"updated_at":"2016-11-16 18:28:18","created_at":"2016-10-28 22:04:10","menu":"0","parent":[{"id":40,"parent_id":"19","category_id":"13","order":"23","status":null,"updated_at":"2016-11-16 18:28:18","created_at":"2016-10-28 22:02:12","menu":"0","parent":[{"id":19,"parent_id":"22","category_id":"13","order":"22","status":"0","updated_at":"2016-11-16 18:28:18","created_at":"2016-10-28 21:20:54","menu":"0","parent":[{"id":22,"parent_id":"0","category_id":"13","order":"21","status":null,"updated_at":"2016-11-16 18:28:18","created_at":"2016-10-28 21:30:38","menu":"0","parent":[],"title":"espa\u00f1ol promotions","slug":"spamol-promotions","short_content":"<p>espa&ntilde;ol promotions<\/p>\r\n","content":"<p>espa&ntilde;ol promotions<\/p>\r\n"}],"title":"promo","slug":"promo","short_content":"<p>promo<\/p>\r\n","content":"<p>gdf gdf gdf gdf<\/p>\r\n"}],"title":"promo espa\u00f1ol","slug":"promo espa\u00f1ol","short_content":"<p>promo espa&ntilde;ol<\/p>\r\n","content":null}],"title":"con detail id","slug":"con detail id","short_content":"<p>con detail id<\/p>\r\n","content":"<p>detail<\/p>\r\n"}

Arturo left a reply on Pluck Collection Keys • 1 year ago

hi @Ricardo, thnks but I had a only one iteration in the collection not in deep

if a put a "depth" argument i have a funky results

array:25 [
  0 => 41
  1 => "40"
  2 => "13"
  3 => "24"
  4 => null
  5 => "2016-11-16 18:28:18"
  6 => "2016-10-28 22:04:10"
  7 => "0"
  8 => 40
  9 => "19"
  10 => "13"
  11 => "23"
  12 => null
  13 => "2016-11-16 18:28:18"
  14 => "2016-10-28 22:02:12"
  15 => "0"
  16 => array:13 [
    "id" => 19
    "parent_id" => "22"
    "category_id" => "13"
    "order" => "22"
    "status" => "0"
    "updated_at" => "2016-11-16 18:28:18"
    "created_at" => "2016-10-28 21:20:54"
    "menu" => "0"
    "parent" => array:1 [
      0 => array:13 [
        "id" => 22
        "parent_id" => "0"
        "category_id" => "13"
        "order" => "21"
        "status" => null
        "updated_at" => "2016-11-16 18:28:18"
        "created_at" => "2016-10-28 21:30:38"
        "menu" => "0"
        "parent" => []
        "title" => "español promotions"
        "slug" => "spamol-promotions"
        "short_content" => "<p>espa&ntilde;ol promotions</p>\r\n"
        "content" => "<p>espa&ntilde;ol promotions</p>\r\n"
      ]
    ]
    "title" => "promo"
    "slug" => "promo"
    "short_content" => "<p>promo</p>\r\n"
    "content" => "<p>gdf gdf gdf gdf</p>\r\n"
  ]
  17 => "promo español"
  18 => "promo español"
  19 => "<p>promo espa&ntilde;ol</p>\r\n"
  20 => null
  21 => "con detail id"
  22 => "con detail id"
  23 => "<p>con detail id</p>\r\n"
  24 => "<p>detail</p>\r\n"
]

other idea?

Arturo started a new conversation Pluck Collection Keys • 1 year ago

Hi everyone I have a nested collection but I can't figure out how pluck or collect the parent key

this is my collection ''' Collection {#426 #items: array:13 [ "id" => 41 "parent_id" => "40" "category_id" => "13" "order" => "24" "status" => null "updated_at" => "2016-11-16 18:28:18" "created_at" => "2016-10-28 22:04:10" "menu" => "0" "parent" => array:1 [ 0 => array:13 [ "id" => 40 "parent_id" => "19" "category_id" => "13" "order" => "23" "status" => null "updated_at" => "2016-11-16 18:28:18" "created_at" => "2016-10-28 22:02:12" "menu" => "0" "parent" => array:1 [ 0 => array:13 [ "id" => 19 "parent_id" => "22" "category_id" => "13" "order" => "22" "status" => "0" "updated_at" => "2016-11-16 18:28:18" "created_at" => "2016-10-28 21:20:54" "menu" => "0" "parent" => array:1 [ 0 => array:13 [ "id" => 22 "parent_id" => "0" "category_id" => "13" "order" => "21" "status" => null "updated_at" => "2016-11-16 18:28:18" "created_at" => "2016-10-28 21:30:38" "menu" => "0" "parent" => [] "title" => "español promotions" "slug" => "spamol-promotions" "short_content" => "

español promotions

\r\n" "content" => "

español promotions

\r\n" ] ] "title" => "promo" "slug" => "promo" "short_content" => "

promo

\r\n" "content" => "

gdf gdf gdf gdf

\r\n" ] ] "title" => "promo español" "slug" => "promo español" "short_content" => "

promo español

\r\n" "content" => null ] ] "title" => "con detail id" "slug" => "con detail id" "short_content" => "

con detail id

\r\n" "content" => "

detail

\r\n" ] } '''

any ideas

Thanls

15th November, 2016

Arturo left a reply on Laracasts Refresh • 1 year ago

one observation, in the listhing in the forum, its posible to implement the visited bihavor, becouse im losing reading again the post was i visited

saludos

27th October, 2016

Arturo started a new conversation Update Polymorphic Relationship • 1 year ago

hi I have this method to update the polymorphic relationship but i cant get it work

public function seoStore(Request $request)
{
$file = $this->file->find($request->file_id);

$seos = $file->seo;

            foreach($seos as $seo)
            {
        $seo->update(([
                'title'         => $request->seo['es']['title'], 
                'description'   => $request->seo['es']['description'], 
                'keywords'      => $request->seo['es']['locale']]));
                
            }
}

but I cant figure it out how complete the update

Some help please

19th October, 2016

Arturo started a new conversation Spatie Medialibrary And Video Url • 1 year ago

Hi, I was reviewing the spatie Laravel Medialibrary, I wonder now if I could work with video urls? like youtube and vimeo to, only to retrive the urls saved or the id from the videos

Thanks

18th October, 2016

Arturo left a reply on Input Value(old()) Problem • 1 year ago

sorry, Im newbie, I need add the contruct method on the model or in the repository?,

Arturo left a reply on Refactoring Repository • 1 year ago

Thanks!!

17th October, 2016

Arturo started a new conversation Refactoring Reposotory • 1 year ago

Hi everyone How I could refactor this methods

public function getList()
    {

        return $this->page
        ->with('details')
        ->with('category')
        ->orderBy('order')
        ->get();

        
    }

    public function getListByCategory($category)
    {
        return $this->page
        ->with('details')
        ->with('category')
        ->whereHas('category' , function($query) use ($category){
            
    
                $query->where('permalink', $category);
            
        })
        ->orderBy('order')
        ->get();
    }

thanks

14th October, 2016

Arturo left a reply on Input Value(old()) Problem • 1 year ago

public function __construct(Page $page, Detail $detail)
    {
        $this->page = $page;
        $this->detail = $detail;
    }
     public function newDetail()
    {
        return new $this->detail;
    }

Arturo left a reply on Input Value(old()) Problem • 1 year ago

ok, thanks seo its a relation how i can send an empty object?

Detail {#359 ▼
  #table: "contents"
  #fillable: array:7 [▼
    0 => "title"
    1 => "short_title"
    2 => "slug"
    3 => "short_content"
    4 => "locale"
    5 => "status"
    6 => "redirect_301"
  ]

Arturo started a new conversation Input Value(old()) Problem • 1 year ago

Hi every one, I have a problem in the create method

  public function create($permalink)
    {
        return view('backend.forms.page.createForm',
                [
                'page' => $this->page->newPage(),
                'detail' => $this->page->newDetail()
                ]);
    }

but in the form I have this input

 <input class="form-control" placeholder="Meta titulo" 
                    name="seo[title]" type="text" 
                        value="{{ old('seo.title', $detail->seo->title) }}" id="meta_title">

where i have this error Trying to get property of non-object

Any help?

6th October, 2016

Arturo left a reply on Where Put This Kind Of Logic • 1 year ago

ok, put the categoriesMenu method on the composer class or call from other class?

Arturo started a new conversation Where Put This Kind Of Logic • 1 year ago

Hi, I'm traying to estructure my app to best possible I have a categorie repository, but I need to add selected atribute to the collection where put this kind of login ? in the same repository? maybe I need create a presenter class?

public function categoriesMenu($permalink){
        $category = $this->categorie->idByName($permalink);
        $categories = $this->categorie->all();
        return $categories->map(function ($categorie) use ($category) {

                if($categorie->id == $category->id)
                {
                    $categorie['selected'] = true;
                }else{
                    $categorie['selected'] = false;
                }
                return $categorie;
            });
    }

some help?

26th September, 2016

Arturo left a reply on Laravel-traslatable From Repository • 1 year ago

Doo! thanks a lot

this is the correct function

public function update_settings($request, $id)
    {


        $category = $this->find($id);

        $category->status = $request->status;
        $category->icon = $request->icon;
        $category->permalink = $request->permalink;
       

        foreach($request->lang as $code => $attr)
        {
            $category->translate($code)->name = $attr['name'];
            
        }

         return $category->save();
        

    }

Thanks

Arturo left a reply on Laravel-traslatable From Repository • 1 year ago

any help?

Arturo left a reply on Laravel-traslatable From Repository • 1 year ago

Yes, i have te trait i my model


namespace App;

use Dimsav\Translatable\Translatable;
use Illuminate\Database\Eloquent\Model;

class Category extends Model
{

    use Translatable;
    protected $table = 'categories';

    public $translationModel = CategoryTranslation::class;
    public $translatedAttributes = ['name'];
}

24th September, 2016

Arturo started a new conversation Laravel-traslatable From Repository • 1 year ago

Hi everybody,

I using the laravel-traslatable package,

my question is how use the save methods from the repository class example I have this class

class CategoryRepository
{
    
    protected $category;

    
    public function __construct(Category $category)
    {
        $this->category = $category;
    }

    public function find($id)
    {
        return $this->category->findOrFail($id);
    }

    public function update_settings($request, $id)
    {


        $category = $this->find($id);

        $category->status = $request->status;
            $category->icon = $request->icon;
            $category->permalink = $request->permalink;
       

        foreach($request->lang as $code => $attr)
        {
            $category->transalate($code)->name($attr['name']);
            
        }

         return $category->save();
        

    }

and i have this error

Call to undefined method Illuminate\Database\Query\Builder::transalate()

10th September, 2016

Arturo left a reply on Change Eloquent Model Relationship Key • 1 year ago

Thanks @ctoma

9th September, 2016

Arturo left a reply on Change Eloquent Model Relationship Key • 1 year ago

I have the same doubt

18th April, 2016

Arturo left a reply on Define Ajax Route • 1 year ago

you need to call the route "/mycontroller/getgeocodes"

29th December, 2015

Arturo left a reply on Change PublicPath() • 1 year ago

I changed the structure like this, I find a tutorial to install laravel on hostgator CpanelUsername/ .composer/ access-logs/ etc/ laravel/ app/ bootstrap/ public/ ... perl5/ public_html/ packages/ .htaccess favicon.ico index.php robots.txt tmp/ www/ .bash_history .bashrc
.bash_profile composer.phar

everything works fine, I moved the public_html/index.php routes to find the laravel folder and everything is good but i have a class to save images and the publicPath() is pointing to the old route

Arturo left a reply on Change PublicPath() • 1 year ago

for reasons of the hosting moved the public folder to the public_html and the app structure to the root of the server

Arturo started a new conversation Change PublicPath() • 1 year ago

Hi, how could override the publicPath() function? I changed the folder name for the public folder

Thanks

28th December, 2015

Arturo left a reply on SEO Benefits On External Links And Relative Links • 1 year ago

he told me that some SEO tools show the percent of external links and if more than internal they penalize you, maybe to think to is a farm link page

Arturo started a new conversation SEO Benefits On External Links And Relative Links • 1 year ago

I have a discussion with a SEO when he told me that the links with the full domain is bad for the SEO page because some robots take this link like external links for example the full path for style files and javascript files.

This is correct?

With html facade is posible to change the route for relative paths?

7th December, 2015

Arturo left a reply on Simple Ajax Call • 1 year ago

I think var brand_id = this.value; for var brand_id = $(this).val();

20th November, 2015

Arturo started a new conversation Create Option With Jquery • 2 years ago

I have this 'for' in jquery for create options dinamically but the active variable doesn't work in the prop attribute, any ideas to assign the var into .prop() attribute?

for (var o = 1, len = config.maxadults; o < len; o++) {
                    var active =  (o == 1) ? "'selected', true" : "'selected', false";
            alert(active);
                    var options = $('<option/>')
            .prop(active)
            .text(o);
                    options.appendTo(select);
                }

21st July, 2015

Arturo left a reply on Problem With Hostgator And Laravel 5.1 • 2 years ago

We don have no value on API Extensions, We will contact hostgator suport

Thanks

20th July, 2015

Arturo started a new conversation Problem With Hostgator And Laravel 5.1 • 2 years ago

In my work have a Server with hostgator, we update to php 5.5.27 to upload the new application but show this error Fatal error: Class 'PDO' not found in /home/.../public_html/.../config/database.php on line 16

Some ideas?

18th May, 2015

Arturo left a reply on Cant Access To A Collection View Composer • 2 years ago

This is my error:

https://laracasts.com/discuss/channels/general-discussion/camelcase-relation-method-name-in-eloquent

How is the best practice with compound nouns in the models?

Arturo left a reply on Cant Access To A Collection View Composer • 2 years ago

I did the Example more easy, I return this json in the var $types

[  
   {  
      "id":"1",
      "type_id":"1",
      "order":"1",
      "menu":"1",
      "parent":"0",
      "module":"0",
      "independent":"0",
      "page_type":{  
         "id":"1",
         "tabs":"1,2,3",
         "status":"1",
         "icon":"icon-home",
         "permalink":"\/",
         "settings":"0"
      }
   },
   {  
      "id":"2",
      "type_id":"2",
      "order":"42",
      "menu":"1",
      "parent":"0",
      "module":"0",
      "independent":"0",
      "page_type":{  
         "id":"2",
         "tabs":"1,2,3",
         "status":"1",
         "icon":"icon-file",
         "permalink":"pages",
         "settings":"0"
        }
   }
]

and trow me the error when I do this

@foreach($types as $seccion)
    {{ $seccion->page_type->permalink }}
   @endforeach

16th May, 2015

Arturo left a reply on Cant Access To A Collection View Composer • 2 years ago

when y try to access to {{ $seccion->page_type_detail->name }} in the foreach I have this error ErrorException in 835fdbd646a40d908c77603dcee52c06 line 6: Trying to get property of non-object

Edit Your Profile
Update

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