承接 reivaj86/chef-auth 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

reivaj86/chef-auth

Composer 安装命令:

composer require reivaj86/chef-auth

包简介

README 文档

README

##Recipes, Ingredients and Category Login "Chef-Captcha" for Laravel 5

Powerful package to implement a simple but effective login authorization step. Replace the normal Word Captcha system with this package. It will provide a very dynamic and interactive way for users to login with additional security.

Install

Install this package in through Composer.

{
    "require": {
        "reivaj86/chef-auth": "dev-master"
    }
}
Run

$ composer update

Add the package ChefAuthServiceProvider to your application service providers in config/app.php

'providers' => [
    
    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    
    'Reivaj86\ChefAuth\ChefAuthServiceProvider',

],

Publish the package migrations and config file to your application.

$ php artisan vendor:publish --provider="Vendor/Reivaj86/ChefAuth/ChefAuthServiceProvider" --tag="config"
$ php artisan vendor:publish --provider="Vendor/Reivaj86/ChefAuth/ChefAuthServiceProvider" --tag="migrations"

Run migrations.

$ php artisan migrate

Configuration file --- chef-auth.php

You can change connection for models, slug separator and there is also a handy cookable feature. Study the config file for more information.

Usage

First of all, include HasIngredient trait and also implement HasIngredientContract inside your User model.

use Reivaj86\ChefAuth\Contracts\HasIngredientContract;
use Reivaj86\ChefAuthTraits\HasIngredient;

class Recipe extends Model implements HasIngredientContract {

	use HasIngredient;

You're set to go. You can create your first recipe, ingredient and category database.

use Reivaj86\ChefAuth\Models\Recipe;

$recipe = Recipe::create([
    'name' => 'Carbonara',
    'slug' => 'carbonara',
    'img'  => 'assets/imgs/carbonara.png'
    'description' => 'Delicious italian pasta dish' // optional
]);

You then can create your first ingredient and attach it to a recipe.

use Reivaj86\ChefAuth\Models\Ingredient;
use Reivaj86\ChefAuth\Models\Recipe;

$ingredient = Ingredient::create([
    'name' => 'Eggs',
    'slug' => 'eggs',
    'description' => '' // optional
]);

$recipe = Recipe::find($id)->attachIngredient($ingredient); // Can pass whole object, or only its id

You can check if the current recipe has required ingredient.

if ($recipe->cooks('eggs')) // you can pass an id or slug
{
    return 'eggs'; // Or an image (return recipe->img;)

}

You can also do this:

if ($recipe->cooksEggs())
{
    return 'eggs';
}

And of course, there is a way to check for multiple ingredients:

if ($recipe->cooks('eggs|cheese')) // or $recipe->cooks('eggs, cheese') and also $recipe->cooks(['eggs', 'cheese'])
{
    // if recipe has at least one ingredient
}

if ($recipe->cooks('eggs|cheese', 'All')) // or $user->cooks('eggs, cheese', 'All') and also $recipe->cooks(['eggs', 'cheese'], 'All')
{
    // if recipe has all ingredients
}

When you are creating ingredients, there is also optional parameter img. It is set to null by default, but you can overwrite it and then you can do something like this:

if (!$ingredient->img = null)
{
    // code
}

Let's talk about categories in general. You can attach a category to an ingredient or directly to a specific ingredient (and of course detach them as well).

use Reivaj86\ChefAuth\Models\Category;
use Reivaj86\ChefAuth\Models\Ingredient;

$category = Category::create([
    'name' => 'Dairy',
    'slug' => 'dairy',
    'description' => 'Dairy products' // optional
]);

Ingredient::find($id)->attachCategory($category);


if ($ingredient->is('dairy') // you can pass an id or slug
{
    return 'Is a Dairy Product!';
}

You can check for multiple categories the same way as ingredients.

This condition checks if the current recipe is the owner of provided ingredient. If not, it will be looking inside ingredient categories for a row we created before.

if ($ingredient->steamed('dairy', $product, false)) // now owner check is disabled
{
    $product->save();
}

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-06-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固