PHP code example of codwelt / laravel-blog

1. Go to this page and download the library: Download codwelt/laravel-blog library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codwelt / laravel-blog example snippets


  'creatorPost' => [
        'model' => App\User::class,
        'columnOfRelation' => 'id'
    ],

  'commentatorPost' => [
        'model' => App\User::class,
        'columnOfRelation' => 'id'
    ],
json
     "post-update-cmd":[
                "@php artisan codwelt_blog:update"
     ]
bash
$ php artisan codwelt_blog:install

   
   
   namespace App;
   
   use Codwelt\Blog\Operations\Core\Traits\CreatorOfPosts;
   use Illuminate\Foundation\Auth\User as Authenticatable;
   
   class User extends Authenticatable
   {
       use CreatorOfPosts;
   
  
    
        
       /**
        * The attributes that are mass assignable.
        *
        * @var array
       */
       protected $fillable = ['id', 'name', 'email', 'password', 'cargo', 'imgperfil', 'telefono', 'emailsecundario', 'activo'];
            
       /**
        * Debe retornar el nombre de quien crea el post
        * @return string
        */
       public function getNameModel()
       {
           return $this->name;
       }
   }


   
   
   namespace App;
   
   use Codwelt\Blog\Operations\Core\Traits\CommentatorOfPosts;
   use Illuminate\Foundation\Auth\User as Authenticatable;
   
   class User extends Authenticatable
   {
       use CommentatorOfPosts;
   
  
    
        
       /**
        * The attributes that are mass assignable.
        *
        * @var array
       */
       protected $fillable = ['id', 'name', 'email', 'password', 'cargo', 'imgperfil', 'telefono', 'emailsecundario', 'activo'];
            
       /**
        * Debe retornar el nombre de quien crea el post
        * @return string
        */
       public function getNameModel()
       {
           return $this->name;
       }

        /**
        * Correo electronico que se mostrara en los comentarios
        * @return string
        */
       public function getEmailModel()
       {
           return $this->email;
       }

    /**
     *  Debe retornar la url de la foto de perfil del usuario, si se retorna nulo se asigna una foto por defecto
     * @return mixed
     */
    public function getUrlImageProfile(){
        $this->url_profile;
    }

   }