laravel-5.2

Not allowed to load local resource with Laravel

不问归期 提交于 2019-12-02 11:42:27
问题 I have put in an upload form in my Laravel application, the file uploads and saves it but when I try to display it I get joew:1 Not allowed to load local resource: file:///C:/xampp/htdocs/socialNet/public/uploads/joew.png This is the root I put in the filesystems.php file 'public' => [ 'driver' => 'local', 'root' => storage_path('public/uploads'), 'visibility' => 'public', ], So the photo is being saved inside a folder called public inside the storage folder. This is the function retrieving

How to upload image with angularjs

对着背影说爱祢 提交于 2019-12-02 09:44:12
问题 I am trying to upload image with angularjs. HTML: <input type="file" id="picture" name="picture"/> <button class="btn btn-primary" ng-click="AddNew()" type="submit">Save</button> Controller.js $scope.AddNew=function(){ console.log(picture.files.item(0)); $scope.myobject.picture=picture[0]; $http({ url: 'http://localhost/mypro/resource', method: "POST", data: {'resource' : $scope.myobject }, headers: {'Content-Type': undefined }, transformRequest: angular.identity }) .then(function(response) {

Combine 5 tables in Laravel and sort by created_at

旧街凉风 提交于 2019-12-02 08:40:10
I'm making website for advertisements and people can publish things they are selling. So I have tables: cars , technology , real_estate , pets etc. All these tables have different columns except "created_at" column which is common for all tables. Example: CARS: [Model, Type, fuel type..., created_at] PETS: [Name, Description..., created_at] So if cars has 5 rows and pets has 7 and real_estate has 3 I need in return 15 rows sorted by created_at . I need to merge all 5 (or more) tables and sort them by created_at (without losing any of rows). Do you have some tips or idea how to do that in

How to upload image with angularjs

非 Y 不嫁゛ 提交于 2019-12-02 06:56:23
I am trying to upload image with angularjs. HTML: <input type="file" id="picture" name="picture"/> <button class="btn btn-primary" ng-click="AddNew()" type="submit">Save</button> Controller.js $scope.AddNew=function(){ console.log(picture.files.item(0)); $scope.myobject.picture=picture[0]; $http({ url: 'http://localhost/mypro/resource', method: "POST", data: {'resource' : $scope.myobject }, headers: {'Content-Type': undefined }, transformRequest: angular.identity }) .then(function(response) { // success }, function(response) { // optional // failed }); }; Laravel 5.2: routes.php Route:

Not allowed to load local resource with Laravel

送分小仙女□ 提交于 2019-12-02 06:15:25
I have put in an upload form in my Laravel application, the file uploads and saves it but when I try to display it I get joew:1 Not allowed to load local resource: file:///C:/xampp/htdocs/socialNet/public/uploads/joew.png This is the root I put in the filesystems.php file 'public' => [ 'driver' => 'local', 'root' => storage_path('public/uploads'), 'visibility' => 'public', ], So the photo is being saved inside a folder called public inside the storage folder. This is the function retrieving the file public function getUserAvatar() { if ($this->username) { $userAvatar = User::where('username',

Laravel 5.2 validation errors not appearing

ぃ、小莉子 提交于 2019-12-02 06:09:54
问题 I am trying to get validation errors to show up in Laravel. I have a UserController set up like so: <?php namespace App\Http\Controllers; use App\User; use App\Http\Controllers\Controller; //Use Request; Use Flash; Use Illuminate\Http\Request; class UserController extends Controller { /** * Show the profile for the given user. * * @param int $id * @return Response */ public function showProfile($id) { return view('user.profile', ['user' => User::findOrFail($id)]); } public function store

Laravel and Angular js file upload

陌路散爱 提交于 2019-12-02 04:45:31
How I can save images with laravel and angular js ? are more inputs , but that work for me , are of type text My index: <div class="container" ng-app="todoApp" ng-controller="todoController"> <h1>Profile</h1> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <h4>Foto de perfil: </h4> <div class="input-group"> <span class="input-group-btn"> <span class="btn btn-primary btn-file"> Browse… <input type='File' name="photo" ng-model="todo.photo" class="image-upload"required/> </span> </span> <input type="text" class="form-control" readonly> </div> </div> <div class="col-sm-6"> <div

Self Join in Laravel 5.2

淺唱寂寞╮ 提交于 2019-12-02 04:09:15
I have the following Ticket Table if(!Schema::hasTable('tblticket')) { Schema::create('tblticket', function (Blueprint $table) { $table->increments('TicketID'); $table->string('Subject', 50); $table->integer('ParentTicketID')->nullable()->unsigned(); $table->timestamps(); $table->foreign('ParentTicketID')->references('TicketID')->on('tblticket'); }); } Primary Key is TicketID and There is another column called ParentTicketID, which is related to TicketID. Below is Ticket Model class TicketModel extends Model { public $table = 'tblticket'; public $primaryKey = 'TicketID'; public $timestamps =

Undefined property: Illuminate\Database\Eloquent\Collection:: Laravel 5.2

心不动则不痛 提交于 2019-12-02 04:01:51
问题 I'm trying to get iot to show The items within an order and i keep getting this error These are my models class westcoorder extends Model { protected $table = 'westcoorders'; protected $with = 'westcoorderitem'; protected $fillable = ['is_sent', 'is_delivered']; /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function westcoorderitem() { return $this->hasMany('App\westcoorderitem'); } } class westcoorderitem extends Model { protected $table = 'westcoorderitems';

Undefined property: Illuminate\\Database\\Eloquent\\Collection:: Laravel 5.2

瘦欲@ 提交于 2019-12-02 01:39:57
I'm trying to get iot to show The items within an order and i keep getting this error These are my models class westcoorder extends Model { protected $table = 'westcoorders'; protected $with = 'westcoorderitem'; protected $fillable = ['is_sent', 'is_delivered']; /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function westcoorderitem() { return $this->hasMany('App\westcoorderitem'); } } class westcoorderitem extends Model { protected $table = 'westcoorderitems'; protected $fillable = ['westcoorder_id','quantity', 'productName', 'productCode', 'price']; public function