当我点击这个:<a href="#/home">home</a>网址是localhost/Sites/App/#!/#%2Fhome
当我点击这个:<a href="#!/home">home</a>网址是localhost/Sites/App/#!/home
但这仅适用于我的计算机,对于我的同事则相反,如果!网址中有链接,则链接不起作用.
我了解SEO最佳实践,但我们没有公共网站,我们需要在网址中使用没有感叹号的网站.
我理解/url是编码的,因为有角度认为这不是路径分隔符,但为什么在我唯一的计算机?我们有相同的代码.
我们使用IIS或IIS express,Chrome或IE,没有任何区别.当它适用于我时,它不适用于所有其他人.
在浏览器网络调用中,我们可以看到链接上的点击和坏网址生成之间没有服务器调用.
这是模块配置:
angular.module('paper.app', [ 'ngMaterial'
, 'ngMessages'
, 'ngRoute'
, ...])
.config(function ($routeProvider, $mdThemingProvider, $mdIconProvider, $locationProvider, $mdDateLocaleProvider, contentUrl, contentSvg) {
$routeProvider
.when("/", {
templateUrl: contentUrl + 'view-home/html/home.html',
controller: 'HomeController',
controllerAs: 'homeCtrl'
})
.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(false);
...
});
Run Code Online (Sandbox Code Playgroud)
这是bower.json:
{
"name": "...",
"version": "1.0.0",
"authors": [
"..."
],
"ignore": [
"node_modules",
"bower_components"
],
"description": "",
"main": "",
"homepage": "",
"dependencies": …Run Code Online (Sandbox Code Playgroud) 当我使用带有 Post 方法的表单请求时,响应是“ index()”方法响应。但它必须是“ store(myRequest $request)”方法。如果我从“ store()”中删除 myRequest $request 方法,它就可以工作。我迷路了,请帮帮我。
我的控制器:
<?php namespace App\Http\Controllers\Ressource;
use App\Http\Requests\CreateCollectionRequest;
use App\Repositories\CollectionRepository;
class CollectionController extends RessourceController {
private $collectionRepository;
public function __construct(CollectionRepository $collectionRepository)
{
parent::__construct();
$this->collectionRepository = $collectionRepository;
}
public function index()
{
return $this->run( function()
{
return $this->collectionRepository->all()->get();
});
}
public function store(CreateCollectionRequest $request)
{
return $this->run( function() use ($request) {
return $this->collectionRepository->create($request->all());
});
}
}
Run Code Online (Sandbox Code Playgroud)
资源控制器:
<?php namespace App\Http\Controllers\Ressource;
use Illuminate\Support\Facades\Response;
use App\Http\Controllers\Controller;
abstract class RessourceController extends Controller
{ …Run Code Online (Sandbox Code Playgroud) 在我的 laravel 项目中,我想使用一个特征来使用 anuuid作为主键并进行级联删除。
有 2 种型号:User和Box。
一个user可以有很多Box,一个也Box可以有很多Box。因为我使用mysql,所以onDelete('cascade')不起作用,但我需要它。
所以我重写了Boot模型的方法来强制它,但是现在,我的特征(UuidIdentifiable)的Boot方法无法被调用。
uuid此特征的用途是在我创建新模型时生成主键。
现在,当我想创建一个模型时,当 Eloquent 插入值时,数据库返回一个错误,因为Id我的模型为 null。
因此,覆盖Boot模型上的 应该覆盖特征的 ,但是如何获得我的特征和模型的Boot自定义方法的功能呢?Boot
<!-- language: php -->
class Box extends Model
{
use UuidIdentifiable;
protected $fillable = ['label', 'parent_box_id', 'user_id'];
protected $guarded = [];
public $incrementing = false;
public function owner() {
return $this->belongsTo('App\User', 'user_id');
}
public function …Run Code Online (Sandbox Code Playgroud) laravel ×2
laravel-5 ×2
php ×2
angularjs ×1
eloquent ×1
iis ×1
javascript ×1
laravel-5.1 ×1
postman ×1
url ×1