Commit 8df5363e authored by 康顺's avatar 康顺

parent 49fee7ee
.DS_Store
phpunit.phar
/vendor
composer.phar
composer.lock
*.project
.idea/
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2015 Jens Segers
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{
"name": "laravel-admin-ext/blog",
"description": "description...",
"type": "library",
"keywords": ["laravel-admin", "extension"],
"homepage": "https://github.com/laravel-admin-ext/blog",
"license": "MIT",
"authors": [
{
"name": "your name",
"email": "your email"
}
],
"require": {
"php": ">=7.0.0",
"encore/laravel-admin": "~1.6"
},
"require-dev": {
"phpunit/phpunit": "~6.0"
},
"autoload": {
"psr-4": {
"SMG\\Blog\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"SMG\\Blog\\BlogServiceProvider"
]
}
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateArticleTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('articles', function (Blueprint $table) {
$table->increments('id');
$table->string('title', 60);
$table->string('description', 60);
$table->text('content');
$table->integer('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('articles');
}
}
Welcome to laravel-admin
\ No newline at end of file
<?php
use SMG\Blog\Http\Controllers\BlogController;
Route::get('blog', BlogController::class.'@index');
\ No newline at end of file
<?php
namespace SMG\Blog;
use Encore\Admin\Extension;
class Blog extends Extension
{
public $name = 'blog';
public $views = __DIR__.'/../resources/views';
public $assets = __DIR__.'/../resources/assets';
public $menu = [
'title' => 'Blog',
'path' => 'blog',
'icon' => 'fa-gears',
];
}
\ No newline at end of file
<?php
namespace SMG\Blog;
use Illuminate\Support\ServiceProvider;
class BlogServiceProvider extends ServiceProvider
{
/**
* {@inheritdoc}
*/
public function boot(Blog $extension)
{
if (! Blog::boot()) {
return ;
}
if ($views = $extension->views()) {
$this->loadViewsFrom($views, 'blog');
}
if ($this->app->runningInConsole() && $assets = $extension->assets()) {
$this->publishes(
[$assets => public_path('vendor/laravel-admin-ext/blog')],
'blog'
);
}
$this->app->booted(function () {
Blog::routes(__DIR__.'/../routes/web.php');
});
}
}
\ No newline at end of file
<?php
namespace SMG\Blog\Http\Controllers;
use Encore\Admin\Layout\Content;
use Illuminate\Routing\Controller;
class BlogController extends Controller
{
public function index(Content $content)
{
return $content
->header('Title')
->description('Description')
->body(view('blog::index'));
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment