PHP code example of elnooronline / laravel-concerns
1. Go to this page and download the library: Download elnooronline/laravel-concerns 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/ */
elnooronline / laravel-concerns example snippets
namespace App\Http\Controllers;
use Elnooronline\LaravelConcerns\Http\Controllers\Helpers;
...
class Controller extends BaseController
{
use Helpers;
...
}
public function store(Request $request)
{
// Handle store
$this->>flash('created'); // returns : trans('%RESOURCE_NAME%.messages.created').
return view('home');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return $this->parseLocale([
'name:{default}' => '
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return $this->getAproperRules();
}
/**
* The rules of create request.
*
* @return array
*/
public function createRules()
{
return [];
}
/**
* The rules of update request.
*
* @return array
*/
public function updateRules()
{
return [];
}
namespace App\Http\Filters;
use Elnooronline\LaravelConcerns\Http\Filters\BaseFilters;
class UserFilter extends BaseFilters
{
/**
* Registered filters to operate upon.
*
* @var array
*/
protected $filters = [
'type',
'created_at',
];
/**
* Filter the query by a given type.
*
* @param string|int $value
* @return \Illuminate\Database\Eloquent\Builder
*/
protected function type($value)
{
return $this->builder->where('type', $value);
}
/**
* Filter the query by a given created at date.
*
* @param string|int $value
* @return \Illuminate\Database\Eloquent\Builder
*/
protected function createdAt($value)
{
return $this->builder->whereDate('created_at', $value);
}
}
Schema::table('users', function (Blueprint $table) {
$table->string('type')->index();
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.