Categories
Laravel

How to resolve The Mix manifest does not exist. ? LARAVEL NOVA Facade\Ignition\Exceptions\ViewException

ERROR

Facade\Ignition\Exceptions\ViewException
The Mix manifest does not exist. 

Solution

php artisan vendor:publish --all

Categories
Laravel

Install Laravel Nova

1 - composer create-project --prefer-dist laravel/laravel admin "5.8.*"


2 - add/update in composer.json the following item
"repositories": [
     {
         "type": "composer",
         "url": "https://nova.laravel.com"
     }
 ],

Next, you may add laravel/nova to your list of required packages in your composer.json file:

"require": {
     "php": "^7.1.3",
     "fideloper/proxy": "^4.0",
     "laravel/framework": "5.8.*",
     "laravel/nova": "~2.0"
 },
3 - php artisan nova:install
4 - php artisan migrate
5- Authorizing Nova in non-local Environment
/**
 Register the Nova gate.
 *
 This gate determines who can access Nova in non-local environments.
 *
 @return void
 */
 protected function gate()
 {
 Gate::define('viewNova', function ($user) {
     return in_array($user->email, [
         '[email protected]',
     ]);
 });
 } 
#6 - Deploy with credentials
composer config http-basic.nova.laravel.com [email protected] mxxxxxxxxxxxxxxxxg
Categories
Laravel

How to Laravel Nova? Postgres

Create Resource

 php artisan nova:resource DirectMailing

Create Model

 php artisan make:model DirectMailing -m

Postgres

How to deal multiple schema ?

Connection variable is critical

protected $connection = 'pgsql-api';

How to deal with Schema and uuids ?

file location : app/LoyaltyLevels.php

class LoyaltyLevels extends Model
{
    //
    protected $connection = 'pgsql-api';
    protected $table = 'api.loyalty_levels';
    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'loyalty_level_uuid';
    protected $keyType = 'string';
}

File location app/Nova/LoyaltyLevels.php

 public function fields(Request $request)
    {
        return [
            Text::make('loyalty_level')->sortable(),
            Text::make('loyalty_level_description')->sortable(),
        ];
    }
Categories
Laravel

Laravel BackPack – Tutorial

   745  composer require backpack/crud:"4.0.*"
   746  composer require backpack/generators --dev
   747  composer require laracasts/generators --dev
   748  php artisan backpack:install
   749  php artisan make:migration:schema create_tags_table --model=0 --schema="name:string:unique"
   750  php artisan migrate
   751  php artisan backpack:crud tag
   752  valet park
   753  valet link
   754  valet links
   755  hisory
   756  history
   757  vim .env
   758  php artisan backpack:crud building
   759  php artisan backpack:crud apartment
   760  php artisan backpack:crud apartment
   

Additionnal Feature

  830  composer require backpack/permissionmanager
  831  php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"
  832  php artisan migrate
  833  php artisan migrate
  834  php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config"
  835  php artisan vendor:publish --provider="Backpack\PermissionManager\PermissionManagerServiceProvider"

BackPack links

  853  php artisan backpack:add-sidebar-content "<li class='nav-item'><a class='nav-link' href='{{ backpack_url('setting') }}'><i class='nav-icon fa fa-cog'></i> <span>Settings</span></a></li>"
  854  Discovered Package: creativeorange/gravatar
  855  composer require backpack/logmanager
  856  php artisan backpack:add-sidebar-content "<li class='nav-item'><a class='nav-link' href='{{ backpack_url('log') }}'><i class='nav-icon fa fa-terminal'></i> Logs</a></li>"
  857  composer require backpack/backupmanager
  858  php artisan vendor:publish --provider="Backpack\BackupManager\BackupManagerServiceProvider"  --tag=config
  859  php artisan backpack:add-sidebar-content "<li class='nav-item'><a class='nav-link' href='{{ backpack_url('backup') }}'><i class='nav-icon fa fa-hdd-o'></i> Backups</a></li>"
  860  composer require seandowney/backpackgallerycrud
Categories
Laravel

Laravel Back pack tutorial

Install important package

  #1  composer require backpack/crud:"4.0.*"
  #2  composer require backpack/generators --dev
  #3  composer require laracasts/generators --dev
  #4  php artisan backpack:install

#5 php artisan make:migration:schema create_tags_table --model=0 --schema="name:string:unique"
  
#6 php artisan migrate
  
#7 php artisan backpack:crud tag

Categories
Laravel

Laravel Socialite

Laravel Socialite makes the experience painless and fast to implement. I highly recommend this package for quick development ! Here

laravel socialite raleche
laravel socialite raleche
Categories
Laravel

Tutorial – How to do a search form with laravel pagination bootstrap ?

Define routes at routes/web.php

//All certificates
Route::post('/search-certificates', 'CertificatesController@search' );
Route::get('/search-certificates', 'CertificatesController@search' );
or
Route::any('/search-certificates', 'CertificatesController@search' );

Define Controller function Search

public function search(Request $request){
    $searchString = $request->input('searchString');
    $searchCertificates = DB::table('NAMEOFYOURBABLE')
        ->where('BOROUGH', 'like', "%$searchString%" )
        ->orwhere('STREET', 'like', "%$searchString%" )
        ->orwhere('POSTCODE', 'like', "%$searchString%" )
        ->orderBy('POSTCODE', 'asc')
        ->orderBy('NUMBER', 'asc')
        ->orderBy('JOB_NUMBER', 'asc')
        ->paginate(20);

    $searchCertificates->appends(['searchString' => $searchString]);

    return view('search-certificates', ['searchCertificates' => $searchCertificates]);
}

Most important line on the code above is the one below because it will allow search pagination

    $searchCertificates->appends(['searchString' => $searchString]);

Define View Laravel Blade Page

Form

<form action="/search-certificates" method="POST" role="search">
    {{ csrf_field() }}
    <div class="input-group">
        <input type="text" class="form-control" name="searchString"
               placeholder="Search by Street or Postal Code " />
         <button type="submit" class="btn btn-primary">Submit</button>
    </div>
</form>

Grid/Table

<div class="row justify-content-center">
<table class="table table-striped">
<thead>
<tr>
<th>POSTCODE</th>
<th>ISSUE_TYPE</th>
<th>C_O_ISSUE_DATE</th>
<th>BOROUGH</th>
<th>NUMBER</th>
<th>STREET</th>
<th>Number of Units</th>
<th>NTA</th>
</tr>
</thead>
<tbody>
@foreach ($searchCertificates as $oneCertificate)
<tr>
<td>{{ $oneCertificate->POSTCODE }}</td>
<td>{{ $oneCertificate->ISSUE_TYPE }}</td>
<td>{{ $oneCertificate->C_O_ISSUE_DATE }}</td>
<td> {{ $oneCertificate->BOROUGH }}</td>
<td>{{ $oneCertificate->NUMBER }}</td>
<td>{{ $oneCertificate->STREET }}</td>
<td>{{ $oneCertificate->PR_DWELLING_UNIT }}</td>
<td>{{ $oneCertificate->NTA }}</td>
</tr>
@endforeach
</tbody>

Blade Pagination Link

{{ $searchCertificates->links( "pagination::bootstrap-4") }}
Categories
Laravel

Tutorial Install Oauth2 Server

Find below the steps to install an Oauth2 server with laravel Passport

Install the package

composer require laravel/passport
php artisan migrate
php artisan passport:install

Retrieve the keys from laravel passport

Personal access client created successfully.
 Client ID: 7
 Client secret: JfTAiRtvsdX2pZI1cBUShCrd2BU5pYYrX0lzHwRhBq
 Password grant client created successfully.
 Client ID: 8
 Client secret: Y3nUHg1xcaOPCsdsdsqbIjA3Ghj5CJnTf0pD1p3t2U5wN

Modify App\User.php file

<?php namespace App;
 use Laravel\Passport\HasApiTokens; 
use Illuminate\Notifications\Notifiable; 
use Illuminate\Foundation\Auth\User as Authenticatable; 

class User extends Authenticatable {    
 use HasApiTokens, Notifiable; 
}

Register the routes necessary to issue access tokens and revoke access tokens, clients, and personal access tokens:

<?php namespace App\Providers; 
use Laravel\Passport\Passport;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; 

class AuthServiceProvider extends ServiceProvider {  
   /**      
    * The policy mappings for the application.      
    *     
    * @var array      
    */     
     protected $policies = [  
       'App\Model' => 'App\Policies\ModelPolicy',   
      ];    
 /**      
   * Register any authentication / authorization services.      
   *
   * @return void     
   */  
   public function boot()     
   {
      $this->registerPolicies();   
      Passport::routes();    
   } 
}

Configure config/auth.php

'guards' => [     
         'web' => [         
                   'driver' => 'session',
                   'provider' => 'users',
           ],
         'api' => [         
                   'driver' => 'passport',
                   'provider' => 'users',    
                ],
 ],

SET TO GO, now get access token to proceed

Use the generated key in initial step called Password grant client

Categories
Laravel

Tutorial – Laravel 6 – Create Login Page

composer require laravel/ui 
php artisan ui vue --auth 
npm install && npm run dev
php artisan migrate

See the routes created

php artisan route:list

Categories
Laravel

Tutorial Log Viewer – Laravel

Fantastic try to the log viewer of Laravel
https://github.com/ARCANEDEV/LogViewer

Edit .env

LOG_CHANNEL=daily

Composer install the package

composer require arcanedev/log-viewer

Publish the laravel package

php artisan log-viewer:publish

Verify installation

php artisan log-viewer:check

Enjoy programming !

Go to http://{your-project}/log-viewer

See Screenshots