1. Go to this page and download the library: Download maxfactor/support 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/ */
maxfactor / support example snippets
use Maxfactor\Support\Model\Traits\HasActiveState;
$table->active();
public function viewInactive($user, $model)
{
if (config('maxfactor-support.canViewInactive')) {
return true;
}
// Your logic... (Gate::allows() etc)
return false;
}
use Maxfactor\Support\Model\Traits\CanBeFeatured;
$table->featured();
use Spatie\EloquentSortable\Sortable;
use Maxfactor\Support\Model\Traits\HasSortOrder;
class Category extends Model implements Sortable
{
use HasSortOrder;
...
}
// Define our additional fields in the resource.
protected function additionalMetaFields()
{
return [
Text::make('Example Meta Content'),
];
}
// Inside the resources fields() function we can pass in our additional fields as a parameter.
MetaAttributes::make($this->additionalMetaFields()),
public function baseCanonical()
{
return route('branch.show', $this);
}
$branch->canonical($url);
@
// Assuming the current url is https://example.com/journal?page=2&tag=news
Maxfactor::urlWithQuerystring('https://example.com/blog', $allowedParameters = 'page=[^1]');
// returns https://example.com/blog?page=2
namespace App\Console;
use Maxfactor\Support\Webpage\Commands\MakeSitemap;
class Sitemap extends MakeSitemap
{
/**
* Populate the sitemap. This method should be overloaded to add content.
*
* @param Sitemap $sitemap
* @return void
*/
public function populate($sitemap)
{
// $sitemap->add('/url');
}
}
// config/auth.php
...
/*
|--------------------------------------------------------------------------
| Environments
|--------------------------------------------------------------------------
|
| Determine which environments should be password protected.
|
*/
'environments' => [
'staging',
],
// App\Page.php
class Page extends Model implements Maxfactor\Support\Webpage\Contracts\SearchResult
{
use Maxfactor\Support\Webpage\Traits\IsSearchResult;
// Implement the public function getResultSummaryAttribute()
{
return $this->summary;
}
public function getResultUrlAttribute()
{
return $this->mapped_url;
}
public function getResultImageAttribute()
{
return $this->image;
}
}
$results = Search::for($query)->in([
Article::published(), // Builder
app(Page::class), // Model
])->get();
$results = Search::for($query)->in([
Article::published(), // Builder
app(Page::class), // Model
])->paginate(2);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.