laravel-4

Regex search and replace on all rows in a table with Laravel 4's Fluent or Eloquent

北慕城南 提交于 2019-12-13 04:35:28
问题 What's the best way to use Fluent or Eloquent to search for a pattern in a MySQL database and replace it? I've seen in the Laravel forums that you should be able to do a regex selection like so // Searching for the word "mypattern"... Page::where('words', 'regexp', DB::raw('/\bmypattern\b/'))->get(); But I've tried this method and it doesn't seem to select the rows I'm after. In any case, actually don't want to JUST select-- I'd like to actually do a search and replace with regex . What's the

How to upload a Cordova picture to a Laravel 4 project by using an API

允我心安 提交于 2019-12-13 04:17:59
问题 I'm making a hybrid app with AngularJS and Cordova, using a Laravel 4 API & Backoffice. I can make a picture with the application, but it does not upload. I don't really know how to upload the picture, and i don't really know how i can troubleshoot all of it. I upload the image to the API-route i wrote, using the same upload-method as i use to do with the backoffice. This is what i have in the AngularJS-Controller, which uses Cordova to do the stuff. var pictureSource; // picture source var

Cannot access protected property -laravel 4

无人久伴 提交于 2019-12-13 04:17:57
问题 I am using oauth to connect facebook with my app token = $fb->requestAccessToken( $code ); will give following OAuth\OAuth2\Token\StdOAuth2Token Object ( [accessToken:protected] => CAAIYQeqXeLYBAIlu6fiQKudu0XQxdCya33PC0cEAZCFDQNkV1KCCZBuOEmXyhkv5VU45kU0pDwSCYoVzLBc7AbHti81mVq9xBgMygA2oLfVArqxboRO1QzgSSCcqqgwZA3nszCmVx6M5MHVXYZBB6g1KpWukRbHWyhVxWUzNWzs81MS3ERiMNK6ZAsYRS9zhYNZABZCTh8SK89tYNGOBuwC [refreshToken:protected] => [endOfLife:protected] => 1411197432 [extraParams:protected] => Array (

Laravel create method

百般思念 提交于 2019-12-13 04:08:07
问题 I'm trying to store an array using Laravel's create method $input = Input::all(); $new_media = $this->media->create($input); or $input = Input::all(); $new_media = Media::create($input); both codes does not work. This is the error I'm getting. Method [create] does not exist. Laravel documentation here http://laravel.com/docs/4.2/eloquent From laravel docs // Create a new user in the database... $user = User::create(array('name' => 'John')); Media Model <?php class Media extends Eloquent {

Issue uploading image, call to undefined function finfo_buffer()

£可爱£侵袭症+ 提交于 2019-12-13 03:56:48
问题 Trying to upload an image via a script based on Laravel framework and coming across this error: Call to undefined function Intervention\Image\finfo_buffer() * Checks if string contains binary image data * * @param mixed $input * @return boolean */ private function isBinary($input) { $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), (string) $input); return substr($mime, 0, 4) != 'text'; } I'm not really that well versed on Laravel so would appreciate some help. Regards 回答1: You need

Api have decode data but not work in form [duplicate]

本秂侑毒 提交于 2019-12-13 03:49:08
问题 This question already has answers here : without select category not show subcategory (2 answers) Closed 11 months ago . This is my create.blade.php file which include ajax function API and HTML tag code.. @extends('layouts.app') @section('content') <link rel="stylesheet" href="http://www.codermen.com/css/bootstrap.min.css"> <script src="http://www.codermen.com/js/jquery.js"></script> <form enctype="multipart/form-data" method="post" action="{{route('post.store')}}" > @csrf <div class="form

Laravel 4 - Is it possible to extend the DB class?

烈酒焚心 提交于 2019-12-13 03:44:07
问题 *Note this is a question regarding Laravel 4, not Laravel 3 (which uses Fluent) Is it possible to extend the DB class in Laravel 4? I've tried something as simple as this: class Content extends DB {} With this in my route: print_r(Content::table('content')->get()); And it seems to work as far as using "Content" like "DB". But if I try and set the table name by default similar to how you would in Eloqeunt and use functions such as where or join I get an error like so: print_r(Content::where(

Create new database on the fly in Laravel 4

早过忘川 提交于 2019-12-13 03:38:26
问题 I want dynamically create new database, database user and password with privileges, create some tables in new database on the fly in Laravel 4 for every new user. This is for a multi tenant website. Whats the best solution? thanks. 回答1: This is not your first database connection it's easy, but you'll have to execute raw statements because database creation is no available as connection methods: DB::statement(DB::raw('CREATE DATABASE <name>')); To do that you can use a secondary connection: <

gmail api adding label id and thread id while sending as reply (send mail with same thread id while reply)

隐身守侯 提交于 2019-12-13 03:34:27
问题 I'm trying to send mail using gmail api using laravel. my sent msg is $text = 'From: '.$from.' To: '.$to.' Subject:'.$subject.' '.$body.''; $encoded_message = rtrim(strtr(base64_encode($text), '+/', '-_'), '='); $message->setRaw($encoded_message); $message = $service->users_messages->send($userId, $message); I tried to edit label id and thread id as follows, $text = 'labelIds: ':'.SENT.' 'From: '.$from.' To: '.$to.' Subject:'.$subject.' '.$body.''; which gives syntax error. How to add labelid

Socket.io - Cannot load file

拟墨画扇 提交于 2019-12-13 03:24:41
问题 I made a web chat application using Node.js, socket.io and express. It's working well. Now I want to move my chat application into my website but i have problem with paths. My website is based on Laravel framework and has this structure. Website /public /js /jquery1-10.js /chat.js ----> client side chat file. /app.js ----> node.js server side file. /index.php Laravel use layouts so in index.php file, URL::asset('/path-to-file') is working well for all files inside public directory. including